# 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.

# PortfolioCVaR

PortfolioCVaR object for conditional value-at-risk portfolio optimization and analysis

## Description

The PortfolioCVaR object implements conditional value-at-risk (CVaR) portfolio optimization. PortfolioCVaR objects support functions that are specific to conditional value-at-risk (CVaR) portfolio optimization.

The main workflow for CVaR portfolio optimization is to create an instance of a `PortfolioCVaR` object that completely specifies a portfolio optimization problem and to operate on the `PortfolioCVaR` object using supported functions to obtain and analyze efficient portfolios. A CVaR optimization problem is completely specified with the following four 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 CVaR optimization, is either the gross or net mean of portfolio returns and the conditional value-at-risk of portfolio returns.

• A probability level that specifies the probability that a loss is less than or equal to the value-at-risk. Typical values are 0.9 and 0.95, which indicate 10% and 5% loss probabilities.

After these four elements have been specified in an unambiguous way, it is possible to solve and analyze CVaR portfolio optimization problems.

The simplest CVaR 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

• A probability level of 0.95

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

```p = PortfolioCVaR('Scenarios', AssetScenarios, 'LowerBound', 0, 'Budget', 1, ... 'ProbabilityLevel', 0.95); ```
or equivalently by:
```p = PortfolioCVaR; p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95);```

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

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

Given the problem specified in the PortfolioCVaR 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 PortfolioCVaR objects, see PortfolioCVaR Object Workflow and for more detailed information on the theoretical basis for conditional value-at-risk optimization, see Portfolio Optimization Theory.

## Create Object

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

## Properties

 PortfolioCVaR Properties Manage Portfolio object for conditional value-at-risk 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 `estimatePortVaR` Estimate value-at-risk for PortfolioCVaR object

`estimatePortStd`

## Examples

expand all

Create efficient portfolios:

```load CAPMuniverse p = PortfolioCVaR('AssetList',Assets(1:12)); p = simulateNormalScenariosByData(p, Data(:,1:12), 20000 ,'missingdata',true); p = setDefaultConstraints(p); p = setProbabilityLevel(p, 0.95); 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.010984 0.073246 0.11933 0.13068 1.5503e-14 AMZN 0 4.5428e-33 3.0815e-32 0 2.9788e-14 CSCO 5.8775e-39 2.1584e-33 6.454e-33 0 4.3011e-14 DELL 0.022454 1.5696e-32 1.8316e-32 0 4.0113e-14 EBAY 0 0 1.9907e-32 2.157e-32 1.376e-15 GOOG 0.20335 0.38055 0.56242 0.75932 1 HPQ 0.041724 0.0099223 8.6221e-33 0 3.9955e-14 IBM 0.44482 0.36453 0.26282 0.11 3.8936e-14 INTC 0 1.7815e-32 1.0009e-32 2.08e-32 3.9308e-14 MSFT 0.27667 0.17175 0.055435 0 4.1988e-14 ORCL 0 0 -1.1724e-32 0 3.8842e-14 YHOO 0 4.5257e-34 7.2037e-33 0 3.6315e-14 ```

## References

For a complete list of references for the PortfolioCVaR object, see Portfolio Optimization.