Main Content

getScenarios

Counterparty scenarios

Description

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

Before you use the getScenarios function, you must run the simulate function. For more information on using a creditMigrationCopula object, see creditMigrationCopula.

example

Examples

collapse all

Load the saved portfolio data.

load CreditMigrationData.mat;

Scale the bond prices for portfolio positions for each bond.

migrationValues = migrationPrices .* numBonds;

Create a creditMigrationCopula object with a four-factor model using creditMigrationCopula.

cmc = creditMigrationCopula(migrationValues,ratings,transMat,...
lgd,weights,'FactorCorrelation',factorCorr)
cmc = 
  creditMigrationCopula with properties:

            Portfolio: [250x5 table]
    FactorCorrelation: [4x4 double]
         RatingLabels: [8x1 string]
     TransitionMatrix: [8x8 double]
             VaRLevel: 0.9500
          UseParallel: 0
      PortfolioValues: []

Set the VaRLevel to 99%.

 cmc.VaRLevel = 0.99;

Use the simulate function to simulate 100,000 scenarios, and then use the getScenarios function to generate the scenarios matrix.

cmc = simulate(cmc,1e5);
scenarios = getScenarios(cmc,[2,3]); 
scenarios(1:10,:)
ans = 10×2
104 ×

    1.3082    1.3216
    0.2893    0.2893
    0.9788    0.9754
    0.4503    0.4503
    1.0376    1.0376
    0.5795    0.5795
    0.5350    0.5350
    0.4956    0.4956
    0.3537    0.3537
    2.3492    2.3492

Input Arguments

collapse all

creditMigrationCopula object obtained after running the simulate function.

For more information on creditMigrationCopula objects, see creditMigrationCopula.

Specifies which scenarios are returned, entered as a vector.

Output Arguments

collapse all

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

Note

If the number of scenarios requested is very large, then the output matrix, scenarios, could be very 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