Plotting the Efficient Frontier for a PortfolioMAD Object
The plotFrontier
function creates a plot of
the efficient frontier for a given portfolio optimization problem. This function accepts
several types of inputs and generates a plot with an optional possibility to output the
estimates for portfolio risks and returns along the efficient frontier. plotFrontier
has four different ways that it can be used. In addition to
a plot of the efficient frontier, if you have an initial portfolio in the
InitPort
property, plotFrontier
also displays the return versus risk of the initial
portfolio on the same plot. If you have a well-posed portfolio optimization problem set
up in a PortfolioMAD
object and you use plotFrontier
, you get a plot of the efficient frontier with the default
number of portfolios on the frontier (the default number is 10
and is
maintained in the hidden property defaultNumPorts
). This example
illustrates a typical use of plotFrontier
to create a new plot:
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)
The Name
property appears as the title of the efficient frontier plot if
you set it in the PortfolioMAD
object. Without an explicit name, the
title on the plot would be “Efficient Frontier.” If you want to obtain a
specific number of portfolios along the efficient frontier, use plotFrontier
with the number of portfolios that you want. Suppose that
you have the PortfolioMAD
object from the previous example and you
want to plot 20 portfolios along the efficient frontier and to obtain 20 risk and return
values for each portfolio:
[prsk, pret] = plotFrontier(p, 20); display([pret, prsk])
ans = 0.0049 0.0176 0.0054 0.0179 0.0058 0.0189 0.0063 0.0205 0.0068 0.0225 0.0073 0.0248 0.0078 0.0274 0.0083 0.0302 0.0088 0.0331 0.0093 0.0361 0.0098 0.0392 0.0103 0.0423 0.0108 0.0457 0.0112 0.0496 0.0117 0.0539 0.0122 0.0586 0.0127 0.0635 0.0132 0.0687 0.0137 0.0744 0.0142 0.0806
Plotting Existing Efficient Portfolios
If you already have efficient portfolios from any of the "estimateFrontier"
functions (see Estimate Efficient Frontiers for PortfolioMAD Object), pass them into plotFrontier
directly to 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); pwgt0 = [ 0.3; 0.3; 0.2; 0.1 ]; p = PortfolioMAD('Name', 'Asset Allocation Portfolio', 'InitPort', pwgt0); p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); pwgt = estimateFrontier(p, 20); plotFrontier(p, pwgt)
Plotting Existing Efficient Portfolio Risks and Returns
If you already have efficient portfolio risks and returns, you
can use the interface to plotFrontier
to
pass them into plotFrontier
to
obtain a plot of 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 ]; AssetScenarios = mvnrnd(m, C, 20000); pwgt0 = [ 0.3; 0.3; 0.2; 0.1 ]; p = PortfolioMAD('Name', 'Asset Allocation Portfolio', 'InitPort', pwgt0); p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); pwgt = estimateFrontier(p); pret= estimatePortReturn(p, pwgt) prsk = estimatePortRisk(p, pwgt) plotFrontier(p, prsk, pret)
pret = 0.0590 0.0723 0.0857 0.0991 0.1124 0.1258 0.1391 0.1525 0.1658 0.1792 prsk = 0.0615 0.0664 0.0795 0.0976 0.1184 0.1408 0.1663 0.1992 0.2368 0.2787
See Also
PortfolioMAD
| estimatePortReturn
| plotFrontier
| estimatePortStd
Related Examples
- Estimate Efficient Frontiers for PortfolioMAD Object
- Creating the PortfolioMAD Object
- Working with MAD Portfolio Constraints Using Defaults
- Estimate Efficient Portfolios Along the Entire Frontier for PortfolioMAD Object
- Asset Returns and Scenarios Using PortfolioMAD Object
- Postprocessing Results to Set Up Tradable Portfolios