Portfolios on constrained efficient frontier
As an alternative to portopt, use the Portfolio object (Portfolio) for mean-variance portfolio optimization. This object supports gross or net portfolio returns as the return proxy, the variance of portfolio returns as the risk proxy, and a portfolio set that is any combination of the specified constraints to form a portfolio set. For information on the workflow when using Portfolio objects, see Portfolio Object Workflow.
[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance,
NumPorts, PortReturn, ConSet, varargin)
1 by number of assets (NASSETS) vector specifying the expected (mean) return of each asset.
NASSETS-by-NASSETS matrix specifying the covariance of the asset returns.
(Optional) Number of portfolios generated along the efficient frontier. Returns are equally spaced between the maximum possible return and the minimum risk point. If NumPorts is empty (entered as ), computes 10 equally spaced points.
(Optional) Expected return of each portfolio. A number of portfolios (NPORTS) by 1 vector. If not entered or empty, NumPorts equally spaced returns between the minimum and maximum possible values are used.
(Optional) Constraint matrix for a portfolio of asset investments, created using portcons. If not specified, a default is created.
(Optional) varargin supports the following parameter-value pairs:
[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance, NumPorts, PortReturn, ConSet, varargin) returns the mean-variance efficient frontier with user-specified covariance, returns, and asset constraints (ConSet). Given a collection of NASSETS risky assets, computes a portfolio of asset investment weights that minimize the risk for given values of the expected return. The portfolio risk is minimized subject to constraints on the total portfolio value, the individual asset minimum and maximum allocation, the asset group minimum and maximum allocation, or the asset group-to-group comparison.
PortRisk is an NPORTS-by-1 vector of the standard deviation of each portfolio.
PortReturn is an NPORTS-by-1 vector of the expected return of each portfolio.
PortWts is an NPORTS-by-NASSETS matrix of weights allocated to each asset. Each row represents a portfolio. The total of all weights in a portfolio is 1.
If portopt is invoked without output arguments, it returns a plot of the efficient frontier.
This example shows how to plot the risk-return efficient frontier of portfolios allocated among three assets. Connect 20 portfolios along the frontier having evenly spaced returns. By default, choose among portfolios without short-selling and scale the value of the portfolio to 1.
ExpReturn = [0.1 0.2 0.15]; ExpCovariance = [0.005 -0.010 0.004 -0.010 0.040 -0.002 0.004 -0.002 0.023]; NumPorts = 20; portopt(ExpReturn, ExpCovariance, NumPorts)
Return the two efficient portfolios that have returns of 16% and 17%. Limit to portfolios that have at least 20% of the allocation in the first asset, and cap the total value in the first and third assets at 50% of the portfolio.
ExpReturn = [0.1 0.2 0.15]; ExpCovariance = [0.005 -0.010 0.004 -0.010 0.040 -0.002 0.004 -0.002 0.023]; PortReturn = [0.16 0.17]; NumAssets = 3; AssetMin = [0.20 NaN NaN]; Group = [1 0 1]; GroupMax = 0.50; ConSet = portcons('Default', NumAssets, 'AssetLims', AssetMin,... NaN,'GroupLims', Group, NaN, GroupMax); [PortRisk, PortReturn, PortWts] = portopt(ExpReturn,... ExpCovariance, , PortReturn, ConSet)
PortRisk = 0.0919 0.1138 PortReturn = 0.1600 0.1700 PortWts = 0.3000 0.5000 0.2000 0.2000 0.6000 0.2000