Main Content

simulate

Simulate credit migrations using creditMigrationCopula object

Description

example

cmc = simulate(cmc,NumScenarios) performs the full simulation of credit scenarios and computes changes in value due to credit rating changes for the portfolio defined in the creditMigrationCopula object. For more information on using a creditMigrationCopula object, see creditMigrationCopula.

Note

When creating a creditMigrationCopula object, you can set the 'UseParallel' property if you have Parallel Computing Toolbox™. Once the 'UseParallel' property is set, parallel processing is used to compute simulate.

example

cmc = simulate(___,Name,Value) adds optional name-value pair arguments for (Copula, DegreesOfFreedom, and BlockSize).

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. After using simulate, you can then use the portfolioRisk, riskContribution, confidenceBands, and getScenarios with the updated creditMigrationCopula object.

cmc = simulate(cmc,1e5)
cmc = 
  creditMigrationCopula with properties:

            Portfolio: [250x5 table]
    FactorCorrelation: [4x4 double]
         RatingLabels: [8x1 string]
     TransitionMatrix: [8x8 double]
             VaRLevel: 0.9900
          UseParallel: 0
      PortfolioValues: [2.0082e+06 1.9950e+06 1.9933e+06 2.0009e+06 1.9819e+06 1.9955e+06 1.9962e+06 1.9966e+06 2.0018e+06 2.0036e+06 1.9873e+06 1.9929e+06 2.0015e+06 1.9875e+06 1.9962e+06 2.0070e+06 2.0054e+06 2.0037e+06 ... ] (1x100000 double)

You can use the riskContribution function with the creditMigrationCopula object to generate the risk Contributions table.

Contributions = riskContribution(cmc);
Contributions(1:10,:)
ans=10×5 table
    ID      EL       Std       VaR       CVaR 
    __    ______    ______    ______    ______

     1    15.521    41.153    238.72    279.18
     2      8.49    18.838    92.074    122.19
     3    6.0937    20.069    113.22    181.53
     4    6.6964    55.885    272.23    313.25
     5    23.583    73.905    360.32    573.39
     6    10.722    114.97    445.94    728.38
     7    1.8393    84.754    262.32    490.39
     8    11.711    39.768    175.84    253.29
     9    2.2154    4.4038    22.797    31.039
    10    1.7453    2.5545    9.8801    17.603

Input Arguments

collapse all

creditMigrationCopula object, obtained from creditMigrationCopula.

For more information on a creditMigrationCopula object, see creditMigrationCopula.

Number of scenarios to simulate, specified as a nonnegative integer. Scenarios are processed in blocks to conserve machine resources.

Data Types: double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: cmc = simulate(cmc,NumScenarios,'Copula','t','DegreesOfFreedom',5,'BlockSize',1000)

Type of copula, specified as the comma-separated pair consisting of 'Copula' and a character vector or string. Possible values are:

  • 'Gaussian' — Gaussian copula

  • 't't copula with degrees of freedom specified by using DegreesOfFreedom.

Data Types: char | string

Degrees of freedom for a t copula, specified as the comma-separated pair consisting of 'DegreesOfFreedom' and a nonnegative numeric value. If Copula is set to 'Gaussian', the DegreesOfFreedom parameter is ignored.

Data Types: double

Number of scenarios to process in each iteration, specified as the comma-separated pair consisting of 'BlockSize' and a nonnegative numeric value. Adjust BlockSize for performance, especially when executing large simulations.

If unspecified, BlockSize defaults to a value of approximately 1,000,000 / (Number-of-counterparties). For example, if there are 100 counterparties, the default BlockSize is 10,000 scenarios.

Data Types: double

Output Arguments

collapse all

creditMigrationCopula object, returned as an updated object that is populated with the simulated PortfolioValues.

For more information on a creditMigrationCopula object, see creditMigrationCopula.

Note

In the simulate function, the Weights (specified when using creditMigrationCopula) are transformed to ensure that the latent variables have a mean of 0 and a variance of 1.

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