Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

plotFrontier

Plot efficient frontier

Use the plotFrontier function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to plot the efficient frontier for a portfolio object.

For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Syntax

[prsk,pret] = plotFrontier(obj)
[prsk,pret] = plotFrontier(obj,varargin)

Description

example

[prsk,pret] = plotFrontier(obj) plots the efficient frontier for a portfolio object.

example

[prsk,pret] = plotFrontier(obj,varargin) plot the efficient frontier for a portfolio object with multiple types of input methods. There are four ways to use plotFrontier:

  • Method 1 — Given a portfolio object obj, estimate the efficient frontier with default number of 10 portfolios on the frontier.

  • Method 2 — Given a portfolio object obj, estimate the efficient frontier with a specified number of portfolios NumPorts on the frontier.

  • Method 3 — Given a portfolio object obj with estimated efficient portfolios in PortWeights, plot the efficient frontier with those portfolios. This method assumes that you provide valid efficient portfolios as input.

  • Method 4 — Given a portfolio object obj with estimated portfolio risks (PortRisk) and returns (PortReturn), plot the efficient frontier. This method assumes that you provide valid inputs for efficient portfolio risks and returns.

Note

plotFrontier handles multiple input formats as described above. Given an asset universe with NumAssets assets and an efficient frontier with NumPorts portfolios, remember that portfolio weights are NumAsset-by-NumPorts matrices and that portfolio risks and returns are NumPorts column vectors.

Examples

collapse all

Given a portfolio p, plot the efficient frontier.

load CAPMuniverse

p = Portfolio('AssetList',Assets(1:12));
p = estimateAssetMoments(p, Data(:,1:12),'missingdata',true);
p = setDefaultConstraints(p);
plotFrontier(p);

Given a PortfolioCVaR p, plot the efficient frontier.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0; 
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;
p = setScenarios(p, AssetScenarios);
p = setDefaultConstraints(p);
p = setProbabilityLevel(p, 0.95);

plotFrontier(p);

Given a PortfolioMAD p, plot the efficient frontier.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0; 
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioMAD;
p = setScenarios(p, AssetScenarios);
p = setDefaultConstraints(p);

plotFrontier(p);

Input Arguments

collapse all

Object for portfolio, specified using Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Optional input methods, specified as varargin can be NumPorts, PortRisk, PortReturn, or PortWeights depending on which of these four input methods you use:

  • Method 1 — Given a portfolio object obj, estimate the efficient frontier with the default number of 10 portfolios on the frontier:

    [prsk, pret] = plotFrontier(obj)

  • Method 2 — Given a portfolio object obj, estimate the efficient frontier with a specified number of portfolios NumPorts on the frontier:

    [prsk, pret] = plotFrontier(obj,NumPorts)

  • Method 3 — Given a portfolio object obj with estimated efficient portfolios in PortWeights, plot the efficient frontier with those portfolios:

    [prsk, pret] = plotFrontier(obj,PortWeights)
    The plotFrontier function assumes that you provide valid efficient portfolios as inputs.

  • Method 4 — Given a portfolio object obj with estimated portfolio risks (PortRisk) and returns (PortReturn), plot the efficient frontier:

    [prsk, pret] = plotFrontier(obj,PortRisk,PortReturn)
    The plotFrontier function assumes that you provide valid efficient portfolio risks and returns as inputs.

Data Types: double

Output Arguments

collapse all

Estimated efficient portfolio risks (standard deviation of returns, returned as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

  • If the portfolio object has a name in the Name property, the name is displayed as the title of the plot. Otherwise, the plot is just labeled “Efficient Frontier.”

  • If the portfolio object has an initial portfolio in the InitPort property, the initial portfolio is plotted and labeled.

  • If portfolio risks and returns are inputs, make sure that risks come first in the calling sequence. In addition, if portfolio risks and returns are not sorted in ascending order, this method performs the sort. On output, the sorted moments are returned.

Estimated efficient portfolio returns, returned as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

  • If the portfolio object has a name in the Name property, the name is displayed as the title of the plot. Otherwise, the plot is labeled “Efficient Frontier.”

  • If the portfolio object has an initial portfolio in the InitPort property, the initial portfolio is plotted and labeled.

  • If portfolio risks and returns are inputs, make sure that risks come first in the calling sequence. In addition, if portfolio risks and returns are not sorted in ascending order, this method performs the sort. On output, the sorted moments are returned.

Tips

You can also use dot notation to plot the efficient frontier.

[prsk, pret] = obj.plotFrontier;

Introduced in R2011a

Was this topic helpful?