Main Content

PortfolioCVaR

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

Description

Use PortfolioCVaR to create a PortfolioCVaR object for conditional value-at-risk 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. For details on this workflow, see PortfolioCVaR Object Workflow.

You can use the PortfolioCVaR object in several ways. To set up a portfolio optimization problem in a PortfolioCVaR object, the simplest syntax is:

p = PortfolioCVaR;
This syntax creates a PortfolioCVaR object, p, such that all object properties are empty.

The PortfolioCVaR object also accepts collections of name-value pair arguments for properties and their values. The PortfolioCVaR function accepts inputs for properties with the general syntax:

	p = PortfolioCVaR('property1',value1,'property2',value2, ... );

If a PortfolioCVaR object already exists, the syntax permits the first (and only the first argument) of the PortfolioCVaR object to be an existing object with subsequent name-value pair arguments for properties to be added or modified. For example, given an existing PortfolioCVaR object in p, the general syntax is:

p = PortfolioCVaR(p,'property1',value1,'property2',value2, ... );

Input argument names are not case sensitive, but must be completely specified. In addition, several properties can be specified with alternative argument names (see Shortcuts for Property Names). The PortfolioCVaR object tries to detect problem dimensions from the inputs and, once set, subsequent inputs can undergo various scalar or matrix expansion operations that simplify the overall process to formulate a problem. In addition, a PortfolioCVaR object is a value object so that, given portfolio p, the following code creates two objects, p and q, that are distinct:

q = PortfolioCVaR(p, ...)

After creating a PortfolioCVaR object, you can use the associated object functions to set portfolio constraints, analyze the efficient frontier, and validate the portfolio model.

For more detailed information on the theoretical basis for conditional value-at-risk portfolio optimization, see Portfolio Optimization Theory.

Creation

Description

p = PortfolioCVaR creates an empty PortfolioCVaR object for conditional value-at-risk portfolio optimization and analysis. You can then add elements to the PortfolioCVaR object using the supported "add" and "set" functions. For more information, see Creating the PortfolioCVaR Object.

example

p = PortfolioCVaR(Name,Value) creates a PortfolioCVaR object (p) and sets Properties using name-value pairs. For example, p = PortfolioCVaR('AssetList',Assets(1:12)). You can specify multiple name-value pairs.

example

p = PortfolioCVaR(p,Name,Value) creates a PortfolioCVaR object (p) using a previously created PortfolioCVaR object p and sets Properties using name-value pairs. You can specify multiple name-value pairs.

example

Input Arguments

expand all

Previously constructed PortfolioCVaR object, specified using PortfolioCVaR.

Properties

expand all

Setting Up the PortflioCVaR Object

Names or symbols of assets in the universe, specified as a cell array of character vectors or a string array.

Data Types: cell | string

Initial portfolio, specified as a vector.

Data Types: double

Name for instance of the PortfolioCVaR object, specified as a character vector or string.

Data Types: char | string

Number of assets in the universe, specified as a positive integer scalar.

Data Types: double

PortfolioCVaR Object Constraints

Linear equality constraint matrix, specified as a matrix. For more information, see Linear Equality Constraints.

Data Types: double

Linear inequality constraint matrix, specified as a matrix. For more information, see Linear Inequality Constraints.

Data Types: double

Linear equality constraint vector, specified as a vector. For more information, see Linear Equality Constraints.

Data Types: double

Linear inequality constraint vector, specified as a vector. For more information, see Linear Inequality Constraints.

Data Types: double

Group A weights to be bounded by weights in group B, specified as a matrix. For more information, see Group Constraints.

Data Types: double

Group B weights, specified as a matrix. For more information, see Group Constraints.

Data Types: double

Group membership matrix, specified as a matrix. For more information, see Group Ratio Constraints.

Data Types: double

Lower-bound constraint, specified as a vector. For more information, see 'Simple' Bound Constraints and 'Conditional' Bound Constraints.

Data Types: double

Lower-bound budget constraint, specified as a scalar. For more information, see Budget Constraints.

Data Types: double

Since R2024b

Weights threshold above which the asset is accounted for in conditional budget, specified as a scalar or a NumAssets-by-1 vector. For more information, see Conditional Budget Constraints.

Data Types: double

Lower-bound group constraint, specified as a vector. For more information, see Group Constraints.

Data Types: double

Minimum ratio of allocations between GroupA and GroupB, specified as a vector. For more information, see Group Ratio Constraints.

Data Types: double

Upper-bound constraint, specified as a vector. For more information, see 'Simple' Bound Constraints and 'Conditional' Bound Constraints.

Data Types: double

Upper-bound budget constraint, specified as a scalar. For more information, see Budget Constraints.

Data Types: double

Since R2024b

Maximum aggregate weight of the portfolio that can be invested in assets that exceed ConditionalBudgetThreshold, specified as a scalar. For more information, see Conditional Budget Constraints.

Data Types: double

Upper-bound group constraint, specified as a vector. For more information, see Group Constraints.

Data Types: double

Maximum ratio of allocations between GroupA and GroupB, specified as a vector. For more information, see Group Ratio Constraints.

Data Types: double

Type of bounds for each asset weight, specified as a scalar character vector or string, or a cell array of character vectors or a string array. For more information, see setBounds.

Data Types: char | cell | string

Minimum number of assets allocated in portfolio, specified as a scalar numeric value. For more information, see setMinMaxNumAssets and Cardinality Constraints.

Data Types: double

Maximum number of assets allocated in portfolio, specified as a scalar numeric value. For more information, see setMinMaxNumAssets and Cardinality Constraints.

Data Types: double

Turnover constraint, specified as a scalar. For more information, see Average Turnover Constraints and One-way Turnover Constraints.

Data Types: double

Turnover constraint on sales, specified as a scalar. For more information, see Average Turnover Constraints and One-way Turnover Constraints.

Data Types: double

Turnover constraint on purchases, specified as a scalar. For more information, see Average Turnover Constraints and One-way Turnover Constraints.

Data Types: double

PortfolioCVaR Object Modeling

Proportional purchase costs, specified as a vector. For more information, see Net Portfolio Returns.

Data Types: double

Risk-free rate, specified as a scalar.

Data Types: double

Value-at-risk probability level which is 1 − (loss probability), specified as a scalar.

Data Types: double

Number of scenarios, specified as an integer scalar.

Data Types: double

Proportional sales costs, specified as a vector. For more information, see Net Portfolio Returns.

Data Types: double

Object Functions

setAssetListSet up list of identifiers for assets
setInitPortSet up initial or current portfolio
setDefaultConstraintsSet up portfolio constraints with nonnegative weights that sum to 1
estimateAssetMomentsEstimate mean and covariance of asset returns from data
setCostsSet up proportional transaction costs for portfolio
addEqualityAdd linear equality constraints for portfolio weights to existing constraints
addGroupRatioAdd group ratio constraints for portfolio weights to existing group ratio constraints
addGroupsAdd group constraints for portfolio weights to existing group constraints
addInequalityAdd linear inequality constraints for portfolio weights to existing constraints
getBoundsObtain bounds for portfolio weights from portfolio object
getBudgetObtain budget constraint bounds from portfolio object
getCostsObtain buy and sell transaction costs from portfolio object
getEqualityObtain equality constraint arrays from portfolio object
getGroupRatioObtain group ratio constraint arrays from portfolio object
getGroupsObtain group constraint arrays from portfolio object
getInequalityObtain inequality constraint arrays from portfolio object
getOneWayTurnoverObtain one-way turnover constraints from portfolio object
setGroupsSet up group constraints for portfolio weights
setInequalitySet up linear inequality constraints for portfolio weights
setBoundsSet up bounds for portfolio weights for portfolio
setMinMaxNumAssetsSet cardinality constraints on the number of assets invested in a portfolio
setBudgetSet up budget constraints for portfolio
setConditionalBudgetSet up conditional budget constraints for portfolio
setCostsSet up proportional transaction costs for portfolio
setDefaultConstraintsSet up portfolio constraints with nonnegative weights that sum to 1
setEqualitySet up linear equality constraints for portfolio weights
setGroupRatioSet up group ratio constraints for portfolio weights
setInitPortSet up initial or current portfolio
setOneWayTurnoverSet up one-way portfolio turnover constraints
setTurnoverSet up maximum portfolio turnover constraint
checkFeasibilityCheck feasibility of input portfolios against portfolio object
estimateBoundsEstimate global lower and upper bounds for set of portfolios
estimateFrontierEstimate specified number of optimal portfolios on the efficient frontier
estimateFrontierByReturnEstimate optimal portfolios with targeted portfolio returns
estimateFrontierByRiskEstimate optimal portfolios with targeted portfolio risks
estimateFrontierLimitsEstimate optimal portfolios at endpoints of efficient frontier
plotFrontierPlot efficient frontier
estimatePortReturnEstimate mean of portfolio returns
estimatePortRiskEstimate portfolio risk according to risk proxy associated with corresponding object
setSolverChoose main solver and specify associated solver options for portfolio optimization
setProbabilityLevelSet probability level for VaR and CVaR calculations
setScenariosSet asset returns scenarios by direct matrix
getScenariosObtain scenarios from portfolio object
simulateNormalScenariosByDataSimulate multivariate normal asset return scenarios from data
simulateNormalScenariosByMomentsSimulate multivariate normal asset return scenarios from mean and covariance of asset returns
estimateScenarioMomentsEstimate mean and covariance of asset return scenarios
estimatePortVaREstimate value-at-risk for PortfolioCVaR object
estimatePortStdEstimate standard deviation of portfolio returns

Examples

collapse all

You can create a PortfolioCVaR object, p, with no input arguments and display it using disp.

p = PortfolioCVaR;
disp(p);
  PortfolioCVaR with properties:

                       BuyCost: []
                      SellCost: []
                  RiskFreeRate: []
              ProbabilityLevel: []
                      Turnover: []
                   BuyTurnover: []
                  SellTurnover: []
                  NumScenarios: []
                          Name: []
                     NumAssets: []
                     AssetList: []
                      InitPort: []
                   AInequality: []
                   bInequality: []
                     AEquality: []
                     bEquality: []
                    LowerBound: []
                    UpperBound: []
                   LowerBudget: []
                   UpperBudget: []
                   GroupMatrix: []
                    LowerGroup: []
                    UpperGroup: []
                        GroupA: []
                        GroupB: []
                    LowerRatio: []
                    UpperRatio: []
                  MinNumAssets: []
                  MaxNumAssets: []
    ConditionalBudgetThreshold: []
        ConditionalUpperBudget: []
                     BoundType: []

This approach provides a way to set up a portfolio optimization problem with the PortfolioCVaR function. You can then use the associated set functions to set and modify collections of properties in the PortfolioCVaR object.

You can use the PortfolioCVaR object directly to set up a “standard” portfolio optimization problem. Given scenarios of asset returns in the variable AssetScenarios, this problem is completely specified as follows:

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 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR('Scenarios', AssetScenarios, ...
'LowerBound', 0, 'LowerBudget', 1, 'UpperBudget', 1, ...
'ProbabilityLevel', 0.95)
p = 
  PortfolioCVaR with properties:

                       BuyCost: []
                      SellCost: []
                  RiskFreeRate: []
              ProbabilityLevel: 0.9500
                      Turnover: []
                   BuyTurnover: []
                  SellTurnover: []
                  NumScenarios: 20000
                          Name: []
                     NumAssets: 4
                     AssetList: []
                      InitPort: []
                   AInequality: []
                   bInequality: []
                     AEquality: []
                     bEquality: []
                    LowerBound: [4x1 double]
                    UpperBound: []
                   LowerBudget: 1
                   UpperBudget: 1
                   GroupMatrix: []
                    LowerGroup: []
                    UpperGroup: []
                        GroupA: []
                        GroupB: []
                    LowerRatio: []
                    UpperRatio: []
                  MinNumAssets: []
                  MaxNumAssets: []
    ConditionalBudgetThreshold: []
        ConditionalUpperBudget: []
                     BoundType: []

Note that the LowerBound property value undergoes scalar expansion since AssetScenarios provides the dimensions of the problem.

Using a sequence of steps is an alternative way to accomplish the same task of setting up a “standard” CVaR portfolio optimization problem, given AssetScenarios variable is:

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 ];

m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;
p = setScenarios(p, AssetScenarios);
p = PortfolioCVaR(p, 'LowerBound', 0);
p = PortfolioCVaR(p, 'LowerBudget', 1, 'UpperBudget', 1);
p = setProbabilityLevel(p, 0.95);

plotFrontier(p);

Figure contains an axes object. The axes object with title Efficient Frontier, xlabel Conditional Value-at-Risk of Portfolio, ylabel Mean of Portfolio Returns contains an object of type line. This object represents Efficient Frontier.

This way works because the calls to PortfolioCVaR are in this particular order. In this case, the call to initialize AssetScenarios provides the dimensions for the problem. If you were to do this step last, you would have to explicitly dimension the LowerBound property as follows:

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 ];

m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;
p = PortfolioCVaR(p, 'LowerBound', zeros(size(m)));
p = PortfolioCVaR(p, 'LowerBudget', 1, 'UpperBudget', 1);
p = setProbabilityLevel(p, 0.95);
p = setScenarios(p, AssetScenarios); 

plotFrontier(p);

Figure contains an axes object. The axes object with title Efficient Frontier, xlabel Conditional Value-at-Risk of Portfolio, ylabel Mean of Portfolio Returns contains an object of type line. This object represents Efficient Frontier.

If you did not specify the size of LowerBound but, instead, input a scalar argument, the PortfolioCVaR object assumes that you are defining a single-asset problem and produces an error at the call to set asset scenarios with four assets.

You can create a PortfolioCVaR object, p with the PortfolioCVaR object using shortcuts for property names.

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 ];

m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR('scenario', AssetScenarios, 'lb', 0, 'budget', 1, 'plevel', 0.95)
p = 
  PortfolioCVaR with properties:

                       BuyCost: []
                      SellCost: []
                  RiskFreeRate: []
              ProbabilityLevel: 0.9500
                      Turnover: []
                   BuyTurnover: []
                  SellTurnover: []
                  NumScenarios: 20000
                          Name: []
                     NumAssets: 4
                     AssetList: []
                      InitPort: []
                   AInequality: []
                   bInequality: []
                     AEquality: []
                     bEquality: []
                    LowerBound: [4x1 double]
                    UpperBound: []
                   LowerBudget: 1
                   UpperBudget: 1
                   GroupMatrix: []
                    LowerGroup: []
                    UpperGroup: []
                        GroupA: []
                        GroupB: []
                    LowerRatio: []
                    UpperRatio: []
                  MinNumAssets: []
                  MaxNumAssets: []
    ConditionalBudgetThreshold: []
        ConditionalUpperBudget: []
                     BoundType: []

Although not recommended, you can set properties directly, however no error-checking is done on your inputs.

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 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;

p = setScenarios(p, AssetScenarios);
p.ProbabilityLevel = 0.95;

p.LowerBudget = 1;
p.UpperBudget = 1;
p.LowerBound = zeros(size(m));
disp(p)
  PortfolioCVaR with properties:

                       BuyCost: []
                      SellCost: []
                  RiskFreeRate: []
              ProbabilityLevel: 0.9500
                      Turnover: []
                   BuyTurnover: []
                  SellTurnover: []
                  NumScenarios: 20000
                          Name: []
                     NumAssets: 4
                     AssetList: []
                      InitPort: []
                   AInequality: []
                   bInequality: []
                     AEquality: []
                     bEquality: []
                    LowerBound: [4x1 double]
                    UpperBound: []
                   LowerBudget: 1
                   UpperBudget: 1
                   GroupMatrix: []
                    LowerGroup: []
                    UpperGroup: []
                        GroupA: []
                        GroupB: []
                    LowerRatio: []
                    UpperRatio: []
                  MinNumAssets: []
                  MaxNumAssets: []
    ConditionalBudgetThreshold: []
        ConditionalUpperBudget: []
                     BoundType: []

Scenarios cannot be assigned directly to a PortfolioCVaR object. Scenarios must always be set through either the PortfolioCVaR function, the setScenarios function, or any of the scenario simulation functions.

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);

Figure contains an axes object. The axes object with title Efficient Frontier, xlabel Conditional Value-at-Risk of Portfolio, ylabel Mean of Portfolio Returns contains an object of type line. This object represents Efficient Frontier.

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.010223    0.073393     0.11939    0.13137    0    
    AMZN           0           0           0          0    0    
    CSCO           0           0           0          0    0    
    DELL     0.02301           0           0          0    0    
    EBAY           0           0           0          0    0    
    GOOG     0.20389     0.38068     0.56253    0.75919    1    
    HPQ     0.041396    0.009472           0          0    0    
    IBM      0.44369     0.36472     0.26247    0.10944    0    
    INTC           0           0           0          0    0    
    MSFT     0.27779     0.17174    0.055611          0    0    
    ORCL           0           0           0          0    0    
    YHOO           0           0           0          0    0    

This example shows how to solve a CVaR portfolio optimization problem with constraints in the number of selected assets or conditional (semicontinuous) bounds. To solve this problem, you can use a PortfolioCVaR object along with different mixed integer nonlinear programming (MINLP) solvers.

CVaR Portfolio

Load the returns data in CAPMuniverse.mat. Then, create a PortfolioCVaR object with default constraints and a long-only portfolio whose weights sum to 1. For this example, you can define the feasible region of weights X as

X={x|i=1nxi=1,xi0}.

% Load data
load CAPMuniverse.mat

% Create portfolio with default constraints
p = PortfolioCVaR(ProbabilityLevel=0.95);
p = simulateNormalScenariosByData(p,Data(:,1:12),1000,missingdata=true);
p = setDefaultConstraints(p);

Include binary variables for this scenario by setting conditional (semicontinuous) bounds. Conditional bounds are those such that xi=0 or xii. In this example, i=0.1 for all assets.

% Set conditional bounds
condLB = 0.1;
condUB = 0.5;
p = setBounds(p,condLB,condUB,BoundType="conditional");

Use estimateFrontier to estimate a set of portfolios on the efficient frontier. The efficient frontier is a curve that shows the trade-off between the return and risk achieved by Pareto-optimal portfolios. For a given return level, the portfolio on the efficient frontier is the one that minimizes the risk while maintaining the desired return. Conversely, for a given risk level, the portfolio on the efficient frontier is the one that maximizes return while maintaining the desired risk level.

% Compute efficient frontier
p = setSolverMINLP(p,'TrustRegionCP',DeltaLowerBound=condLB);
pwgt = estimateFrontier(p)
pwgt = 12×10

         0         0         0         0         0         0         0         0         0         0
         0         0         0   -0.0000         0         0   -0.0000         0         0         0
         0         0         0         0         0         0         0         0         0         0
    0.1000    0.1094    0.1000    0.1000         0         0         0    0.0000         0         0
         0         0         0    0.1000    0.1662    0.2634    0.3369    0.4051    0.4647    0.5000
    0.1328    0.2387    0.3331    0.3263    0.3622    0.3543    0.3701    0.3854    0.4287    0.5000
    0.1000         0         0         0         0         0         0         0         0         0
    0.4132    0.3888    0.2755    0.2552    0.2288    0.1812    0.1110         0         0         0
         0         0         0         0         0         0         0         0         0         0
    0.2540    0.2631    0.2914    0.2185    0.2427    0.2011    0.1821    0.2095    0.1067         0
      ⋮

% Compute risk and returns of the portfolios on the efficient frontier
rsk = estimatePortRisk(p,pwgt)
rsk = 10×1

    0.0368
    0.0377
    0.0398
    0.0423
    0.0453
    0.0485
    0.0520
    0.0558
    0.0598
    0.0647

ret = estimatePortReturn(p,pwgt)
ret = 10×1

    0.0009
    0.0012
    0.0014
    0.0016
    0.0019
    0.0021
    0.0023
    0.0026
    0.0028
    0.0030

Plot the weights from the frontier estimation using plotFrontier. The resulting curve is piece-wise concave with possible vertical jumps (discontinuities) between the concave intervals.

% Plot efficient frontier
plotFrontier(p,pwgt)

Figure contains an axes object. The axes object with title Efficient Frontier, xlabel Conditional Value-at-Risk of Portfolio, ylabel Mean of Portfolio Returns contains an object of type line. This object represents Efficient Frontier.

Changing MINLP Solvers

In the previous section, you use the default solver for estimateFrontier. However, you can solve mixed-integer portfolio problems using any of the three algorithms supported by setSolverMINLP: OuterApproximation, ExtendedCP, and TrustRegionCP. Furthermore, the OuterApproximation algorithm accepts an additional name-value argument (ExtendedFormulation) for Portfolio problems, which reformulates problems with quadratic functions to work in an extended space that usually decreases the computation time. All algorithms, including the extended formulation variation of the OuterApproximation algorithm, return the same values within numerical accuracy. The available solvers are:

  • OuterApproximation — The default algorithm, which is robust and usually faster than ExtenedCP

  • OuterApproximation with ExtendedFormulation set to true — A robust algorithm that is usually faster than other algorithms, but only supported for Portfolio object problems

  • ExtendedCP — The most robust solver, but usually the slowest

  • TrustRegionCP — The fastest algorithm, but one that is less robust and may provide suboptimal solutions

For more information on solvers for mixed-integer portfolio problems, see Choose MINLP Solvers for Portfolio Problems.

To change the MINLP solvers, use setSolverMINLP.

% Select 'TrustRegionCP' as solver
p_OA = setSolverMINLP(p,'OuterApproximation');
pwgt_OA = estimateFrontier(p_OA);
rskOA = estimatePortRisk(p,pwgt_OA);
retOA = estimatePortReturn(p,pwgt_OA);

% Select 'ExtendedCP' as solver using 'midway' cuts as 'CutGeneration'
p_ECP = setSolverMINLP(p,'ExtendedCP',CutGeneration="midway");
pwgt_ECP = estimateFrontier(p_ECP);
rskECP = estimatePortRisk(p,pwgt_ECP);
retECP = estimatePortReturn(p,pwgt_ECP);

Compare the returns and risks obtained by the portfolios on the efficient frontier from the different solvers. They are all the same within a numerical accuracy that is an absolute difference 10-4.

retTable = table(retOA,ret,retECP,'VariableNames',{'OA','TR','ECP'})
retTable=10×3 table
        OA            TR           ECP    
    __________    __________    __________

    0.00092881    0.00092876    0.00092876
     0.0011614     0.0011613     0.0011613
      0.001394     0.0013939     0.0013939
     0.0016265     0.0016265     0.0016265
     0.0018591     0.0018591     0.0018591
     0.0020917     0.0020917     0.0020917
     0.0023243     0.0023243     0.0023243
     0.0025569     0.0025569     0.0025569
     0.0027894     0.0027894     0.0027894
      0.003022      0.003022      0.003022

rskTable = table(rskOA,rsk,rskECP,'VariableNames',{'OA','TR','ECP'})
rskTable=10×3 table
       OA          TR         ECP   
    ________    ________    ________

    0.036808    0.036808    0.036808
    0.037658    0.037658    0.037658
    0.039808    0.039808    0.039808
    0.042256    0.042256    0.042256
     0.04527    0.045269    0.045269
    0.048489    0.048488    0.048488
    0.051963    0.051963    0.051963
    0.055783    0.055783    0.055783
    0.059828    0.059828    0.059828
    0.064705    0.064705    0.064705

% Compare risks from the different OuterApproximation formulations
norm(rskTable.OA-rskTable.TR,Inf) <= 1e-4
ans = logical
   1

More About

expand all

References

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

Version History

Introduced in R2012b

expand all