Learn R Programming

PortfolioAnalytics (version 2.0.0)

chart.RiskBudget: Generic method to chart risk contribution

Description

This function is the generic method to chart risk budget objectives for optimize.portfolio, optimize.portfolio.rebalancing, and opt.list objects. This function charts the contribution or percent contribution of the resulting objective measures of a risk_budget_objective. The risk contributions for optimize.portfolio.rebalancing objects are plotted through time with chart.StackedBar.

Usage

chart.RiskBudget(object, ...)

# S3 method for optimize.portfolio chart.RiskBudget( object, ..., neighbors = NULL, risk.type = "absolute", main = "Risk Contribution", ylab = "", xlab = NULL, cex.axis = 0.8, cex.lab = 0.8, element.color = "darkgray", las = 3, ylim = NULL )

# S3 method for optimize.portfolio.rebalancing chart.RiskBudget( object, ..., match.col = "ES", risk.type = "absolute", regime = NULL, main = "Risk Contribution" )

# S3 method for opt.list chart.RiskBudget( object, ..., match.col = "ES", risk.type = "absolute", main = "Risk Budget", plot.type = "line", cex.axis = 0.8, cex.lab = 0.8, element.color = "darkgray", las = 3, ylim = NULL, colorset = NULL, legend.loc = NULL, cex.legend = 0.8 )

Arguments

object

optimal portfolio object created by optimize.portfolio or optimize.portfolio.rebalancing

...

any other passthru parameters to plot

neighbors

risk contribution or pct_contrib of neighbor portfolios to be plotted, see Details.

risk.type

"absolute" or "percentage" to plot risk contribution in absolute terms or percentage contribution.

main

main title for the chart.

ylab

label for the y-axis.

xlab

label for the x-axis.

cex.axis

the magnification to be used for axis annotation relative to the current setting of cex.

cex.lab

the magnification to be used for axis annotation relative to the current setting of cex.

element.color

provides the color for drawing less-important chart elements, such as the box lines, axis lines, etc.

las

numeric in {0,1,2,3}; the style of axis labels

0:

always parallel to the axis [default],

1:

always horizontal,

2:

always perpendicular to the axis,

3:

always vertical.

ylim

set the y-axis limit, same as in plot

match.col

string of risk column to match. The opt.list object may contain risk budgets for ES or StdDev and this will match the proper column names of the objectives list outp (e.g. ES.contribution).

regime

integer of the regime number. For use with optimize.portfolio.rebalancing run with regime switching portfolios.

plot.type

"line" or "barplot".

colorset

color palette or vector of colors to use

legend.loc

legend.loc NULL, "topright", "right", or "bottomright". If legend.loc is NULL, the legend will not be plotted

cex.legend

The magnification to be used for the legend relative to the current setting of cex

Details

neighbors may be specified in three ways. The first is as a single number of neighbors. This will extract the neighbors closest to the portfolios in terms of the out numerical statistic. The second method consists of a numeric vector for neighbors. This will extract the neighbors with portfolio index numbers that correspond to the vector contents. The third method for specifying neighbors is to pass in a matrix. This matrix should look like the output of extractStats, and should contain properly named contribution and pct_contrib columns.

See Also

optimize.portfolio optimize.portfolio.rebalancing chart.StackedBar