Learn R Programming

PortfolioAnalytics (version 2.0.0)

extractEfficientFrontier: Extract the efficient frontier data points

Description

This function extracts the efficient frontier from an object created by optimize.portfolio.

Usage

extractEfficientFrontier(
  object,
  match.col = "ES",
  n.portfolios = 25,
  risk_aversion = NULL
)

Value

an efficient.frontier object with weights and other metrics along the efficient frontier

Arguments

object

an optimal portfolio object created by optimize.portfolio

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

risk_aversion

vector of risk_aversion values to construct the efficient frontier. n.portfolios is ignored if risk_aversion is specified and the number of points along the efficient frontier is equal to the length of risk_aversion.

Author

Ross Bennett

Details

If the object is an optimize.portfolio.ROI object and match.col is "ES", "ETL", or "CVaR", then the mean-ETL efficient frontier will be created via meanetl.efficient.frontier.

If the object is an optimize.portfolio.ROI object and match.col is "StdDev", then the mean-StdDev efficient frontier will be created via meanvar.efficient.frontier. Note that if 'var' is specified as the name of an objective, the value returned will be 'StdDev'.

For objects created by optimize.portfolo with the DEoptim, random, or pso solvers, the efficient frontier will be extracted from the object via extract.efficient.frontier. This means that optimize.portfolio must be run with trace=TRUE.