Main Content

getScenarios

Counterparty scenarios

Description

example

scenarios = getScenarios(cdc,scenarioIndices) returns counterparty scenario details as a matrix of individual losses for each counterparty for the scenarios requested in scenarioIndices.

The simulate function must be run before getScenarios is used. For more information on using a creditDefaultCopula object, see creditDefaultCopula.

Examples

collapse all

Load saved portfolio data.

load CreditPortfolioData.mat;

Create a creditDefaultCopula object with a two-factor model.

cdc = creditDefaultCopula(EAD,PD,LGD,Weights2F,'FactorCorrelation',FactorCorr2F)
cdc = 
  creditDefaultCopula with properties:

            Portfolio: [100x5 table]
    FactorCorrelation: [2x2 double]
             VaRLevel: 0.9500
          UseParallel: 0
      PortfolioLosses: []

Set the VaRLevel to 99%.

cdc.VaRLevel = 0.99;

Use the simulate function before running getScenarios. Use the getSenarios function with the creditDefaultCopula object to generate the scenarios matrix.

cdc = simulate(cdc,1e5);
scenarios = getScenarios(cdc,[2,3]);
% expected loss for each scenario
mean(scenarios)
ans = 1×2

    0.0369    0.0329

Input Arguments

collapse all

creditDefaultCopula object obtained after running the simulate function.

For more information on creditDefaultCopula objects, see creditDefaultCopula.

Specifies which scenarios are returned, entered as a vector.

Output Arguments

collapse all

Counterparty losses, returned as NumCounterparties-by-N matrix where N is the number of elements in scenarioIndices.

Note

If the number of scenarios requested is large, then the output matrix, scenarios, could be large and potentially limited by the available machine memory.

References

[1] Crouhy, M., Galai, D., and Mark, R. “A Comparative Analysis of Current Credit Risk Models.” Journal of Banking and Finance. Vol. 24, 2000, pp. 59 – 117.

[2] Gordy, M. “A Comparative Anatomy of Credit Risk Models.” Journal of Banking and Finance. Vol. 24, 2000, pp. 119 – 149.

[3] Gupton, G., Finger, C., and Bhatia, M. “CreditMetrics – Technical Document.” J. P. Morgan, New York, 1997.

[4] Jorion, P. Financial Risk Manager Handbook. 6th Edition. Wiley Finance, 2011.

[5] Löffler, G., and Posch, P. Credit Risk Modeling Using Excel and VBA. Wiley Finance, 2007.

[6] McNeil, A., Frey, R., and Embrechts, P. Quantitative Risk Management: Concepts, Techniques, and Tools. Princeton University Press, 2005.

Version History

Introduced in R2017a