minimum and maximum number of assets in portfolio optimization
2 views (last 30 days)
Show older comments
I am doing a portfolio optimization with a large number of assets using a portfolio object, and I want to be able to set a minimum and maximum number of assets that the optimizer can allocate to. Any idea on how to do this?
0 Comments
Answers (1)
Neelanshu
on 10 Jan 2024
Hello Robert,
I understand from your inquiry that you're interested in setting a minimum and maximum number of assets for the optimizer to allocate in portfolio optimization.
You can employ the “setMinMaxNumAssets” function available since MATLAB R2018b in 'Portfolio' object to impose cardinality constraints on the number of assets in which to invest in a portfolio. This function allows you to define “MinNumAsset”` and “MaxNumAssets”, which represent the minimum and maximum number of assets to be invested in the portfolio, respectively. The total number of allocated assets, which must satisfy the bound constraints, will fall within the range of [MinNumAssets, MaxNumAssets]. To restrict the total number of assets to no more than two, you can use “setMinMaxNumAssets” as demonstrated in the following code snippet:
AssetMean = [ 0.0101110; 0.0043532; 0.0137058 ];
AssetCovar = [ 0.00324625 0.00022983 0.00420395;
0.00022983 0.00049937 0.00019247;
0.00420395 0.00019247 0.00764097 ];
p = Portfolio('AssetMean', AssetMean, 'AssetCovar', AssetCovar);
p = setDefaultConstraints(p);
p = setMinMaxNumAssets(p, [], 2); %setting MaxNumAssets to 2
pwgt = estimateFrontierByReturn(p,[ 0.008, 0.01 ])
p %the MaxNumAssets property is set to 2
You may refer to the following documentation to learn more about “setMinMaxNumAssets”:
Hope this helps.
0 Comments
See Also
Categories
Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!