Obtaining Efficient Portfolios for Target Risks
This example shows how to obtain efficient portfolios that have targeted portfolio risks using the estimateFrontierByRisk
function.
The estimateFrontierByRisk
function accepts one or more target portfolio risks and obtains efficient portfolios with the specified risks. Suppose that you have a universe of four assets where you want to obtain efficient portfolios with target portfolio risks of 12%, 14%, and 16%.
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 ]; p = Portfolio; p = setAssetMoments(p, m, C); p = setDefaultConstraints(p); pwgt = estimateFrontierByRisk(p, [0.12, 0.14, 0.16]); display(pwgt)
pwgt = 4×3
0.3984 0.2659 0.1416
0.3064 0.3791 0.4474
0.0882 0.1010 0.1131
0.2071 0.2540 0.2979
Sometimes, you can request a risk for which no efficient portfolio exists. Based on the previous code, suppose that you want a portfolio with 7% risk (individual assets in this universe have risks ranging from 8% to 35%). It turns out that a portfolio with 7% risk cannot be formed with these four assets. estimateFrontierByRisk
warns if your target risks are outside the range of efficient portfolio risks and replaces it with the endpoint of the efficient frontier closest to your target risk. The best way to avoid this situation is to bracket your target portfolio risks with estimateFrontierLimits
and estimatePortRisk
(see Obtaining Endpoints of the Efficient Frontier and Obtaining Portfolio Risks and Returns).
prsk = estimatePortRisk(p, p.estimateFrontierLimits); display(prsk)
prsk = 2×1
0.0769
0.3500
This result indicates that efficient portfolios have risks that range from 7.7% to 35%.
Starting with an initial portfolio, estimateFrontierByRisk
also returns purchases and sales to get from your initial portfolio to the target portfolios on the efficient frontier. For example, given an initial portfolio in pwgt0
, you can obtain purchases and sales from the example with target risks of 12%, 14%, and 16%:
pwgt0 = [ 0.3; 0.3; 0.2; 0.1 ]; p = setInitPort(p, pwgt0); [pwgt, pbuy, psell] = estimateFrontierByRisk(p, [0.12, 0.14, 0.16]); display(pwgt)
pwgt = 4×3
0.3984 0.2659 0.1416
0.3064 0.3791 0.4474
0.0882 0.1010 0.1131
0.2071 0.2540 0.2979
display(pbuy)
pbuy = 4×3
0.0984 0 0
0.0064 0.0791 0.1474
0 0 0
0.1071 0.1540 0.1979
display(psell)
psell = 4×3
0 0.0341 0.1584
0 0 0
0.1118 0.0990 0.0869
0 0 0
If you do not specify an initial portfolio, the purchase and sale weights assume that your initial portfolio is 0
.
See Also
Portfolio
| estimateFrontier
| estimateFrontierLimits
| estimatePortMoments
| estimateFrontierByReturn
| estimatePortReturn
| estimatePortRisk
| estimateFrontierByRisk
| estimateMaxSharpeRatio
| setSolver
Topics
- Estimate Efficient Portfolios for Entire Efficient Frontier for Portfolio Object
- Creating the Portfolio Object
- Working with Portfolio Constraints Using Defaults
- Estimate Efficient Frontiers for Portfolio Object
- Asset Allocation Case Study
- Portfolio Optimization Examples Using Financial Toolbox
- Portfolio Optimization with Semicontinuous and Cardinality Constraints
- Black-Litterman Portfolio Optimization Using Financial Toolbox
- Portfolio Optimization Using Factor Models
- Portfolio Optimization Using Social Performance Measure
- Diversify Portfolios Using Custom Objective
- Portfolio Object
- Portfolio Optimization Theory
- Portfolio Object Workflow