Documentation

portopt

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. For more information on migrating portopt code to Portfolio, see portopt Migration to Portfolio Object.

portopt will be partially removed in a future release will no longer accept ConSet or varargin arguments. Use Portfolio instead to solve portfolio problems that are more than a long-only fully-invested portfolio. For more information on migrating portopt code to Portfolio, see portopt Migration to Portfolio Object.

Syntax

[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance,
NumPorts, PortReturn, ConSet, varargin)

Arguments

ExpReturn

1 by number of assets (NASSETS) vector specifying the expected (mean) return of each asset.

ExpCovariance

NASSETS-by-NASSETS matrix specifying the covariance of the asset returns.

NumPorts

(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.

PortReturn

(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.

ConSet

(Optional) Constraint matrix for a portfolio of asset investments, created using portcons. If not specified, a default is created.

varargin

(Optional) varargin supports the following parameter-value pairs:

  • 'algorithm' – Defines which algorithm to use with portopt. Use either a value of 'lcprog' or 'quadprog' to indicate the algorithm to use. The default is 'lcprog'.

  • 'maxiter' – Maximum number of iterations before termination of algorithm. The default is 100000.

  • 'tiebreak' – Method to break ties for pivot selection. This value pair applies only to 'lcprog' algorithm. The default is 'first'. Options are:

    • 'first' – Selects pivot with lowest index.

    • 'last' – Selects pivot with highest index.

    • 'random' – Selects pivot at random.

  • 'tolcon' – Tolerance for constraint violations. This value pair applies only to 'lcprog' algorithm. The default is 1.0e-6.

  • 'tolpiv' – Pivot value below which a number is considered to be zero. This value pair applies only to 'lcprog'algorithm. The default is 1.0e-9.

Description

[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.

Examples

collapse all

Plot the Risk-Return 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)
Warning: In a future release, portopt will undergo a change to solve only
the default portfolio problem for long-only fully-invested portfolios.
To solve more general problems, use the Portfolio object.
See the release notes for details, including examples to make the conversion. 
> In portopt at 85 

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)
Warning: In a future release, portopt will no longer accept ConSet or varargin arguments.
'It will only solve the portfolio problem for long-only fully-invested portfolios.
To solve more general problems, use the Portfolio object.
See the release notes for details, including examples to make the conversion. 
> In portopt at 83 

PortRisk =

    0.0919
    0.1138


PortReturn =

    0.1600
    0.1700


PortWts =

    0.3000    0.5000    0.2000
    0.2000    0.6000    0.2000

Related Examples

Introduced before R2006a

Was this topic helpful?