# Using PortfolioCVaR Objects

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

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.

## Examples

collapse all

### Construct a PortfolioCVaR Object and Determine Efficient Portfolios

Create efficient portfolios:

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.5092e-14
AMZN     4.702e-38    3.0815e-33     4.702e-38    2.9398e-32    2.8997e-14
CSCO             0    4.6222e-33    1.1755e-38    1.2326e-32    4.1869e-14
DELL      0.022454    1.3193e-32    5.0693e-38    1.9706e-48    3.9048e-14
EBAY             0             0    4.1142e-38    5.2385e-32    1.3394e-15
GOOG       0.20335       0.38055       0.56242       0.75932             1
HPQ       0.041724     0.0099223             0    8.9376e-33    3.8894e-14
IBM        0.44482       0.36453       0.26282          0.11    3.7902e-14
INTC             0             0    1.4106e-37             0    3.8264e-14
MSFT       0.27667       0.17175      0.055435             0    4.0873e-14
ORCL    1.4694e-38    1.4448e-32     2.351e-38    8.4071e-33    3.7811e-14
YHOO             0             0    1.1755e-38      1.04e-32     3.535e-14

## 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 standard deviation of portfolio returns (portfolio risk) 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

## Create Object

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