# Documentation

### This is machine translation

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

PortfolioMAD object for mean-absolute deviation portfolio optimization and analysis

## Description

The PortfolioMAD object implements mean-absolute deviation portfolio optimization, where MAD stands for “mean-absolute deviation.” PortfolioMAD objects support functions that are specific to MAD portfolio optimization.

The main workflow for MAD portfolio optimization is to create an instance of a PortfolioMAD object that completely specifies a portfolio optimization problem and to operate on the PortfolioMAD object to obtain and analyze efficient portfolios. A MAD optimization problem is completely specified with these three elements:

• A universe of assets with scenarios of asset total returns for a period of interest, where scenarios comprise a collection of samples from the underlying probability distribution for asset total returns. This collection must be sufficiently large for asymptotic convergence of sample statistics. Asset return moments and related statistics are derived exclusively from the scenarios.

• A portfolio set that specifies the set of portfolio choices in terms of a collection of constraints.

• A model for portfolio return and risk proxies, which, for MAD optimization, is either the gross or net mean of portfolio returns and the mean-absolute deviation of portfolio returns.

After these three elements have been specified unambiguously, it is possible to solve and analyze MAD portfolio optimization problems.

The simplest MAD portfolio optimization problem has:

• Scenarios of asset total returns

• A requirement that all portfolios have nonnegative weights that sum to 1 (the summation constraint is known as a budget constraint)

• Built-in models for portfolio return and risk proxies that use scenarios of asset total returns

Given scenarios of asset returns in the variable `AssetScenarios`, this problem is completely specified by:

`p = PortfolioMAD('Scenarios', AssetScenarios, 'LowerBound', 0, 'Budget', 1);`
or equivalently by:
```p = PortfolioMAD; p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); ```

To confirm that this is a valid portfolio optimization problem, the following function determines whether the set of PortfolioMAD choices is bounded (a necessary condition for portfolio optimization).

`[lb, ub, isbounded] = estimateBounds(p);`

Given the problem specified in the PortfolioMAD object `p`, the efficient frontier for this problem can be displayed with:

`plotFrontier(p);`
and efficient portfolios can be obtained with:
`pwgt = estimateFrontier(p);`

For more information on the workflow when using PortfolioMAD objects, seePortfolioMAD Object Workflow and for more detailed information on the theoretical basis for mean-absolute deviation optimization, see Portfolio Optimization Theory.

## Creation

To create a `PortfolioMAD` object, use the `PortfolioMAD` function. For more details on working with a PortfolioMAD object, see:

## Properties

 PortfolioMAD Properties Manage PortfolioMAD object for mean-absolute deviation portfolio optimization and analysis

## Object Functions

 `setAssetList` Set up list of identifiers for assets `setInitPort` Set up initial or current portfolio `setDefaultConstraints` Set up portfolio constraints with nonnegative weights that sum to 1 `estimateAssetMoments` Estimate mean and covariance of asset returns from data `setCosts` Set up proportional transaction costs `addEquality` Add linear equality constraints for portfolio weights to existing constraints `addGroupRatio` Add group ratio constraints for portfolio weights to existing group ratio constraints `addGroups` Add group constraints for portfolio weights to existing group constraints `addInequality` Add linear inequality constraints for portfolio weights to existing constraints `getBounds` Obtain bounds for portfolio weights from portfolio object `getBudget` Obtain budget constraint bounds from portfolio object `getCosts` Obtain buy and sell transaction costs from portfolio object `getEquality` Obtain equality constraint arrays from portfolio object `getGroupRatio` Obtain group ratio constraint arrays from portfolio object `getGroups` Obtain group constraint arrays from portfolio object `getInequality` Obtain inequality constraint arrays from portfolio object `getOneWayTurnover` Obtain one-way turnover constraints from portfolio object `setGroups` Set up group constraints for portfolio weights `setInequality` Set up linear inequality constraints for portfolio weights `setBounds` Set up bounds for portfolio weights `setBudget` Set up budget constraints `setCosts` Set up proportional transaction costs `setDefaultConstraints` Set up portfolio constraints with nonnegative weights that sum to 1 `setEquality` Set up linear equality constraints for portfolio weights `setGroupRatio` Set up group ratio constraints for portfolio weights `setInitPort` Set up initial or current portfolio `setOneWayTurnover` Set up one-way portfolio turnover constraints `setTurnover` Set up maximum portfolio turnover constraint `checkFeasibility` Check feasibility of input portfolios against portfolio object `estimateBounds` Estimate global lower and upper bounds for set of portfolios `estimateFrontier` Estimate specified number of optimal portfolios on the efficient frontier `estimateFrontierByReturn` Estimate optimal portfolios with targeted portfolio returns `estimateFrontierByRisk` Estimate optimal portfolios with targeted portfolio risks `estimateFrontierLimits` Estimate optimal portfolios at endpoints of efficient frontier `plotFrontier` Plot efficient frontier `estimatePortReturn` Estimate mean of portfolio returns `estimatePortRisk` Estimate portfolio risk according to risk proxy associated with corresponding object `setSolver` Choose main solver and specify associated solver options for portfolio optimization `setProbabilityLevel` Set probability level for VaR and CVaR calculations `setScenarios` Set asset returns scenarios by direct matrix `getScenarios` Obtain scenarios from portfolio object `simulateNormalScenariosByData` Simulate multivariate normal asset return scenarios from data `simulateNormalScenariosByMoments` Simulate multivariate normal asset return scenarios from mean and covariance of asset returns `estimateScenarioMoments` Estimate mean and covariance of asset return scenarios `estimatePortStd` Estimate standard deviation of portfolio returns

## Examples

expand all

Create efficient portfolios:

```load CAPMuniverse p = PortfolioMAD('AssetList',Assets(1:12)); p = simulateNormalScenariosByData(p, Data(:,1:12), 20000 ,'missingdata',true); p = setDefaultConstraints(p); plotFrontier(p);```

```pwgt = estimateFrontier(p, 5); pnames = cell(1,5); for i = 1:5 pnames{i} = sprintf('Port%d',i); end Blotter = dataset([{pwgt},pnames],'obsnames',p.AssetList); disp(Blotter);```
``` Port1 Port2 Port3 Port4 Port5 AAPL 0.030236 0.075387 0.11278 0.13456 1.5092e-14 AMZN 1.6541e-21 1.8269e-22 1.1341e-22 1.1658e-33 2.8997e-14 CSCO 1.5007e-22 3.6088e-23 5.7857e-24 -5.0613e-34 4.1869e-14 DELL 0.0089659 0 0 3.6065e-18 3.9048e-14 EBAY 2.0446e-22 3.838e-23 2.5657e-24 6.3019e-17 1.3394e-15 GOOG 0.16117 0.35201 0.54486 0.74888 1 HPQ 0.056551 0.024037 4.3354e-24 2.4041e-33 3.8894e-14 IBM 0.45905 0.37891 0.29383 0.11656 3.7902e-14 INTC 0 1.0096e-21 0 1.9259e-34 3.8264e-14 MSFT 0.28403 0.16966 0.048527 0 4.0873e-14 ORCL 5.3466e-21 9.3937e-23 3.3353e-22 -1.3404e-34 3.7811e-14 YHOO 0 2.8818e-23 2.8929e-24 1.7548e-34 3.535e-14 ```

## References

[1] For a complete list of references for the PortfolioMAD object, see Portfolio Optimization.