Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

simulate

Simulate credit migrations using creditMigrationCopula object

Syntax

cmc = simulate(cmc,NumScenarios)
cmc = simulate(___,Name,Value)

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.

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
      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
      PortfolioValues: [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 =

  10x3 table

    ID      EL       CVaR 
    __    ______    ______

     1    16.397    254.12
     2    9.1179    134.31
     3    5.7873    236.84
     4    6.4235    338.23
     5    22.739    544.69
     6    10.776    704.29
     7    2.9046     551.4
     8    12.152    265.97
     9    2.1567    26.112
    10    1.7495    15.933

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 Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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

collapse all

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.

Introduced in R2017a

Was this topic helpful?