Documentation Center

  • Trials
  • Product Updates

getScenarios

Class: PortfolioCVaR

Obtain scenarios from PortfolioCVaR object

Syntax

Y = getScenarios(obj)

Description

Y = getScenarios(obj) obtains scenarios from a PortfolioCVaR object.

Tips

Use dot notation to obtain scenarios from a PortfolioCVaR object.

Y = obj.getScenarios;

Input Arguments

obj

CVaR portfolio object [PortfolioCVaR].

Output Arguments

Y

Scenarios matrix [NumScenarios]-by-[NumAssets].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

expand all

Obtain Scenarios for a CVaR Portfolio Object

For a given PortfolioCVaR object p, display the defined scenarios.

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;

rng(11);

AssetScenarios = mvnrnd(m, C, 10);

p = PortfolioCVaR;
p = p.setScenarios(AssetScenarios);
p = p.setDefaultConstraints;
p = p.setProbabilityLevel(0.95);

Y = getScenarios(p)
Y =

   -0.0056    0.0440    0.1186    0.0488
   -0.0368   -0.0753    0.0087    0.1124
    0.0025    0.0856    0.0484    0.1404
    0.0318    0.0826    0.0377    0.0404
    0.0013   -0.0561   -0.1466   -0.0621
    0.0035    0.0310   -0.0183    0.1225
   -0.0519   -0.1634   -0.0526    0.1528
    0.0029   -0.1163   -0.0627   -0.0760
    0.0192   -0.0182   -0.1243   -0.1346
    0.0440    0.0189    0.0098    0.0821

The function rng( $seed$ ) resets the random number generator to produce the documented results. It is not necessary to reset the random number generator to simulate scenarios.

See Also

|

More About

Was this topic helpful?