Learn R Programming

PortfolioAnalytics (version 2.0.0)

chart.EfficientFrontier: Chart the efficient frontier and risk-return scatter

Description

Chart the efficient frontier and risk-return scatter of the assets for optimize.portfolio or efficient.frontier objects

Usage

chart.EfficientFrontier(object, ...)

# S3 method for optimize.portfolio.CVXR chart.EfficientFrontier( object, ..., optimize_method = "CVXR", match.col = "ES", n.portfolios = 25, xlim = NULL, ylim = NULL, cex.axis = 0.8, element.color = "darkgray", main = "Efficient Frontier", RAR.text = "SR", rf = 0, tangent.line = TRUE, cex.legend = 0.8, chart.assets = TRUE, labels.assets = TRUE, pch.assets = 21, cex.assets = 0.8 )

# S3 method for optimize.portfolio.ROI chart.EfficientFrontier( object, ..., optimize_method = "ROI", match.col = "ES", n.portfolios = 25, xlim = NULL, ylim = NULL, cex.axis = 0.8, element.color = "darkgray", main = "Efficient Frontier", RAR.text = "SR", rf = 0, tangent.line = TRUE, cex.legend = 0.8, chart.assets = TRUE, labels.assets = TRUE, pch.assets = 21, cex.assets = 0.8 )

# S3 method for optimize.portfolio chart.EfficientFrontier( object, ..., match.col = "ES", n.portfolios = 25, xlim = NULL, ylim = NULL, cex.axis = 0.8, element.color = "darkgray", main = "Efficient Frontier", RAR.text = "SR", rf = 0, tangent.line = TRUE, cex.legend = 0.8, chart.assets = TRUE, labels.assets = TRUE, pch.assets = 21, cex.assets = 0.8 )

# S3 method for efficient.frontier chart.EfficientFrontier( object, ..., match.col = "ES", n.portfolios = NULL, xlim = NULL, ylim = NULL, cex.axis = 0.8, element.color = "darkgray", main = "Efficient Frontier", RAR.text = "SR", rf = 0, tangent.line = TRUE, cex.legend = 0.8, chart.assets = TRUE, labels.assets = TRUE, pch.assets = 21, cex.assets = 0.8 )

Arguments

object

object to chart.

...

passthru parameters to plot

optimize_method

the optimize method to get the efficient frontier

match.col

string name of column to use for risk (horizontal axis). match.col must match the name of an objective measure in the objective_measures or opt_values slot in the object created by optimize.portfolio.

n.portfolios

number of portfolios to use to plot the efficient frontier.

xlim

set the x-axis limit, same as in plot.

ylim

set the y-axis limit, same as in plot.

cex.axis

numerical value giving the amount by which the axis should be magnified relative to the default.

element.color

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

main

a main title for the plot.

RAR.text

string name for risk adjusted return text to plot in the legend.

rf

risk free rate. If rf is not null, the maximum Sharpe Ratio or modified Sharpe Ratio tangency portfolio will be plotted.

tangent.line

TRUE/FALSE to plot the tangent line.

cex.legend

numerical value giving the amount by which the legend should be magnified relative to the default.

chart.assets

TRUE/FALSE to include the assets.

labels.assets

TRUE/FALSE to include the asset names in the plot. chart.assets must be TRUE to plot asset names.

pch.assets

plotting character of the assets, same as in plot.

cex.assets

numerical value giving the amount by which the asset points and labels should be magnified relative to the default.

Author

Ross Bennett, Xinran Zhao

Details

For objects created by optimize.portfolio with 'DEoptim', 'random', or 'pso' specified as the optimize_method:

  • The efficient frontier plotted is based on the the trace information (sets of portfolios tested by the solver at each iteration) in objects created by optimize.portfolio.

For objects created by optimize.portfolio with 'ROI' specified as the optimize_method:

  • The mean-StdDev or mean-ETL efficient frontier can be plotted for optimal portfolio objects created by optimize.portfolio.

  • If match.col="StdDev", the mean-StdDev efficient frontier is plotted.

  • If match.col="ETL" (also "ES" or "CVaR"), the mean-ETL efficient frontier is plotted.

Note that trace=TRUE must be specified in optimize.portfolio

GenSA does not return any useable trace information for portfolios tested at each iteration, therfore we cannot extract and chart an efficient frontier.

By default, the tangency portfolio (maximum Sharpe Ratio or modified Sharpe Ratio) will be plotted using a risk free rate of 0. Set rf=NULL to omit this from the plot.