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 defaults using a creditDefaultCopula object

Syntax

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

Description

example

cdc = simulate(cdc,NumScenarios) performs the full simulation of credit scenarios and computes defaults and losses for the portfolio defined in the creditDefaultCopula object.

For more information on using a creditDefaultCopula object, see creditDefaultCopula.

example

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

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
      PortfolioLosses: []

Set the VaRLevel to 99%.

cdc.VaRLevel = 0.99;

Use the simulate function with the creditDefaultCopula object. After using simulate, you can then use the portfolioRisk, riskContribution, confidenceBands, and getScenarios functions with the updated creditDefaultCopula object.

cdc = simulate(cdc,1e5)
cdc = 

  creditDefaultCopula with properties:

            Portfolio: [100x5 table]
    FactorCorrelation: [2x2 double]
             VaRLevel: 0.9900
      PortfolioLosses: [1x100000 double]

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

Contributions = riskContribution(cdc);
Contributions(1:10,:)
ans =

  10x3 table

    ID        EL           CVaR   
    __    __________    __________

     1      0.038604       0.12868
     2      0.067068       0.24527
     3        1.2527        2.3103
     4     0.0023253     0.0026274
     5       0.11766       0.26223
     6       0.12437       0.47915
     7       0.82913        1.6516
     8    0.00085629    0.00089197
     9       0.91406         4.009
    10       0.24352        2.2781

Input Arguments

collapse all

creditDefaultCopula object, obtained from creditDefaultCopula.

For more information on a creditDefaultCopula object, see creditDefaultCopula.

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: cdc = simulate(cdc,NumScenarios,'Copula','t','DegreesOfFreedom',5)

collapse all

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

  • 'Gaussian' — A Gaussian copula

  • 't' — A t copula with degrees of freedom specified 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.

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

Updated creditDefaultCopula object. The object is populated with the simulated PortfolioLosses.

For more information on a creditDefaultCopula object, see creditDefaultCopula.

Note

In the simulate function, the Weights (specified when using creditDefaultCopula) 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?