portfolioBasic-class {portfolio}R Documentation

Class "portfolioBasic"

Description

An object of the lightweight class "portfolioBasic" contains a data frame of weights and a data frame of supplementary information.

Objects from the Class

Objects can be created by calls of the form new("portfolioBasic", ...).

Slots

name:
Object of class "character" containing the name of this portfolio.
date:
Object of class "Date" containing a date for this portfolio.
data:
Object of class "data.frame" containing supplementary information about the positions in this portfolio. Must include a unique column specified in the id.var slot.
id.var:
Object of class "character" containing the name of the column in the data slot to be used as a unique identifier.
symbol.var:
Object of class "character" containing the name of the column in the data slot to be used as a descriptive symbol.
in.var:
Object of class "character" containing the name of the column in the data slot to be used as a rank vector in calls to create.
weight.var:
Object of class "character" containing the name of the column in the data slot to be used as weight overrides in calls to create.
ret.var:
Object of class "character" containing the name of the column in the data slot to be used as the return in calls to performance.
type:
Object of class "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:
Object of class "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:
Object of class "data.frame" containing the data frame of weights for this portfolio's positions. Must contain a unique column called "id".

Methods

+
signature(e1 = "portfolioBasic", e2 = "portfolioBasic")
balance
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.
contribution
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.
create
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.
exposure
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.
matching
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 ....
performance
signature(object = "portfolioBasic"): returns a list containing performance results.
plot
signature(x = "portfolioBasic", y = "missing"): Plot this object.
portfolioDiff
signature(object = "portfolioBasic", x = "portfolioBasic"): computes the difference, as a portfolioBasic object, between two portfolios.
scaleWeights
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.
show
signature(object = "portfolioBasic"): display this object, briefly.
summary
signature(object = "portfolioBasic"): display descriptive information about this portfolio.
initialize
signature(object = "portfolioBasic"): initialize the portfolio by calling create.

Author(s)

Jeff Enos jeff@kanecap.com

Examples

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"))

[Package portfolio version 0.2-2 Index]