portfolioBasic-class {portfolio} | R Documentation |
An object of the lightweight class "portfolioBasic" contains a data frame of weights and a data frame of supplementary information.
Objects can be created by calls of the form new("portfolioBasic", ...)
.
name
:"character"
containing
the name of this portfolio. date
:"Date"
containing a date
for this portfolio. data
:"data.frame"
containing
supplementary information about the positions in this portfolio.
Must include a unique column specified in the id.var
slot. id.var
:"character"
containing the name of the column in the data
slot to be used as
a unique identifier. symbol.var
:"character"
containing the name of the column in the data
slot to be used as
a descriptive symbol. in.var
:"character"
containing
the name of the column in the data
slot to be used as a rank
vector in calls to create
.weight.var
:"character"
containing the name of the column in the data
slot to be used as
weight overrides in calls to create
. ret.var
:"character"
containing
the name of the column in the data
slot to be used as the return
in calls to performance
.type
:"character"
containing
the type of weight formation to use in calls to create
.
May be one of "relative", "equal", "linear", "sigmoid",
"centroid", or "complex".
Defaults to equal
. size
:"characterOrNumeric"
containing the size of the portfolio to use in calls to
create
. May either contain the number of securities per
side or one of "decile", "quintile", "quartile", "tercile", or
"demile". Defaults to quintile
. weights
:"data.frame"
containing the data frame of weights for this portfolio's
positions. Must contain a unique column called "id". signature(e1 = "portfolioBasic", e2 = "portfolioBasic")
signature(object = "portfolioBasic", in.var = "character")
:
balances the positions in portfolio object
to be neutral to
the categories specified by column in.var
in the data
slot.signature(object = "portfolioBasic",
contrib.var = "character")
: returns one data.frame with
contribution analysis for each element of contrib.var
. All
results are returned in a list.signature(object = "portfolioBasic")
: use this
object's creation parameters (such as in slots size
and
type
) to create and return a new object of class
portfolioBasic
.signature(object = "portfolioBasic", exp.var
= "character")
: returns one data.frame with
exposure analysis for each element of contrib.var
. All
results are returned in a list. signature(object = "portfolioBasic",
covariates = "character")
:
returns a matching portfolio along the dimensions specified in the
character vector covariates
. This method requires the
MatchIt package; additional arguments to the matchit
function may be passed via ...
.signature(object = "portfolioBasic")
:
returns a list containing performance results. signature(x = "portfolioBasic", y = "missing")
: Plot
this object. signature(object = "portfolioBasic", x =
"portfolioBasic")
: computes the difference, as a
portfolioBasic
object, between two portfolios. signature(object = "portfolioBasic")
:
scale weights to the weights supplied in the target
parameter. To restrict the set of positions whose weights are
scaled, use the condition
argument. signature(object = "portfolioBasic")
: display
this object, briefly. signature(object = "portfolioBasic")
: display
descriptive information about this portfolio. signature(object = "portfolioBasic")
:
initialize the portfolio by calling create
. Jeff Enos jeff@kanecap.com
data(dow.jan.2005) p <- new("portfolioBasic", id.var = "symbol", in.var = "price", sides = "long", ret.var = "month.ret", data = dow.jan.2005) summary(p) exposure(p, exp.var = c("price", "sector")) performance(p) contribution(p, contrib.var = c("cap.bil", "sector")) p <- new("portfolioBasic", id.var = "symbol", in.var = "price", type = "linear", sides = c("long", "short"), ret.var = "month.ret", data = dow.jan.2005) summary(p) exposure(p, exp.var = c("price", "sector")) performance(p) contribution(p, contrib.var = c("cap.bil","sector"))