Plotting the Efficient Frontier for a PortfolioCVaR
Object
This example shows how to use 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 PortfolioCVaR
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 currently 10
and is maintained in the hidden property defaultNumPorts
).
Create Efficient Frontier Plot
To plot the efficient frontier for a PortflioCVaR
object, use of plotFrontier
.
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)
The Name
property appears as the title of the efficient frontier plot if you set it in the PortfolioCVaR
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 this PortfolioCVaR
object 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])
0.0050 0.0404 0.0055 0.0412 0.0060 0.0435 0.0066 0.0471 0.0071 0.0515 0.0076 0.0567 0.0081 0.0625 0.0086 0.0689 0.0091 0.0756 0.0096 0.0825 0.0101 0.0896 0.0106 0.0970 0.0111 0.1055 0.0117 0.1156 0.0122 0.1269 0.0127 0.1390 0.0132 0.1519 0.0137 0.1653 0.0142 0.1791 0.0147 0.1932
Plotting Existing Efficient Portfolios
If you already have efficient portfolios from any of the "estimateFrontier" functions (see Estimate Efficient Portfolios for Entire Frontier for PortfolioCVaR 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 = PortfolioCVaR('Name', 'Asset Allocation Portfolio', 'InitPort', pwgt0); p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95); 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 = PortfolioCVaR('Name', 'Asset Allocation Portfolio', 'InitPort', pwgt0); p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95); pwgt = estimateFrontier(p); pret= estimatePortReturn(p, pwgt); prsk = estimatePortRisk(p, pwgt); plotFrontier(p, prsk, pret)
See Also
PortfolioCVaR
| estimatePortReturn
| plotFrontier
| estimatePortStd
| estimatePortVaR
Topics
- Estimate Efficient Frontiers for PortfolioCVaR Object
- Creating the PortfolioCVaR Object
- Working with CVaR Portfolio Constraints Using Defaults
- Asset Returns and Scenarios Using PortfolioCVaR Object
- Estimate Efficient Portfolios for Entire Frontier for PortfolioCVaR Object
- Postprocessing Results to Set Up Tradable Portfolios
- Hedging Using CVaR Portfolio Optimization
- Compute Maximum Reward-to-Risk Ratio for CVaR Portfolio
- PortfolioCVaR Object
- Portfolio Optimization Theory
- PortfolioCVaR Object Workflow