# Documentation

### This is machine translation

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

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

# creditDefaultCopula

Create `creditDefaultCopula` object to simulate and analyze multifactor credit default model

## Description

The `creditDefaultCopula` class simulates portfolio losses due to counterparty defaults using a multifactor model. `creditDefaultCopula` associates each counterparty with a random variable, called a latent variable, which is mapped to default/non-default outcomes for each scenario such that defaults occur with probability `PD`. In the event of default, a loss for that scenario is recorded equal to `EAD` * `LGD` for the counterparty. These latent variables are simulated using a multi-factor model, where systemic credit fluctuations are modeled with a series of risk factors. These factors can be based on industry sectors (such as financial, aerospace), geographical regions (such as USA, Eurozone), or any other underlying driver of credit risk. Each counterparty is assigned a series of weights which determine their sensitivity to each underlying credit factors.

The inputs to the model describe the credit-sensitive portfolio of exposures:

• `EAD` — Exposure at default

• `PD` — Probability of default

• `LGD` — Loss given default (1 − Recovery)

• `Weights` — Factor and idiosyncratic model weights

After the `creditDefaultCopula` object is created (see Create creditDefaultCopula and Properties), use the `simulate` function to simulate credit defaults using the multifactor model. The results are stored in the form of a distribution of losses at the portfolio and counterparty level. Several risk measures at the portfolio level are calculated, and the risk contributions from individual obligors. The model calculates:

• Full simulated distribution of portfolio losses across scenarios

• Losses on each counterparty across scenarios

• Several risk measures (`VaR`, `CVaR`, `EL`, `Std`) with confidence intervals

• Risk contributions per counterparty (for `EL` and `CVaR`)

## Creation

### Syntax

``cdc = creditDefaultCopula(EAD,PD,LGD,Weights)``
``cdc = creditDefaultCopula(___,Name,Value)``

### Description

example

````cdc = creditDefaultCopula(EAD,PD,LGD,Weights)` creates a `creditDefaultCopula` object. The `creditDefaultCopula` object has the following properties: Portfolio:A table with the following variables (each row of the table represents one counterparty):`ID` — ID to identify each counterparty`EAD` — Exposure at default`PD` — Probability of default `LGD` — Loss given default`Weights` — Factor and idiosyncratic weights for counterparties FactorCorrelation:Factor correlation matrix, a `NumFactors`-by-`NumFactors` matrix that defines the correlation between the risk factors. VaRLevel:The value-at-risk level, used when reporting VaR and CVaR. PortfolioLossesPortfolio losses, a `NumScenarios`-by-`1` vector of portfolio losses. This property is empty until the `simulate` function is used. ```

example

````cdc = creditDefaultCopula(___,Name,Value)` sets Properties using name-value pairs and any of the arguments in the previous syntax. For example, ```cdc = creditDefaultCopula(EAD,PD,LGD,Weights,'VaRLevel',0.99)```. You can specify multiple name-value pairs.adds optional name-value pair arguments. ```

### Input Arguments

expand all

Exposure at default, specified as a `NumCounterparties`-by-`1` vector of credit exposures. The `EAD` input sets the Portfolio property.

### Note

The `creditDefaultCopula` model simulates defaults and losses over some fixed time period (for example, one year). The counterparty exposures (`EAD`) and default probabilities (`PD`) must both be specific to a particular time.

Data Types: `double`

Probability of default, specified as a `NumCounterparties`-by-`1` numeric vector with elements from `0` through `1`, representing the default probabilities for the counterparties. The `PD` input sets the Portfolio property.

### Note

The `creditDefaultCopula` model simulates defaults and losses over a fixed time period (for example, one year). The counterparty exposures (`EAD`) and default probabilities (`PD`) must both be specific to a particular time.

Data Types: `double`

Loss given default, specified as a `NumCounterparties`-by-`1` numeric vector with elements from `0` through `1`, representing the fraction of exposure that is lost when a counterparty defaults. `LGD` is defined as (1 − Recovery). For example, an `LGD` of 0.6 implies a 40% recovery rate in the event of a default. The `LGD` input sets the Portfolio property.

`LGD` can alternatively be specified as a `NumCounterparties`-by-`2` matrix, where the first column holds the LGD mean values and the 2nd column holds the LGD standard deviations. Valid open intervals for LGD mean and standard deviation are:

• For the first column, the mean values are between `0` and `1`.

• For the second column, the LGD standard deviations are between `0` and `sqrt(m*(1-m))`.

Then, in the case of default, LGD values are drawn randomly from a beta distribution with provided parameters for the defaulting counterparty.

Data Types: `double`

Factor and idiosyncratic weights, specified as a `NumCounterparties`-by-(`NumFactors` + `1`) array. Each row contains the factor weights for a particular counterparty. Each column contains the weights for an underlying risk factor. The last column in `Weights` contains the idiosyncratic risk weight for each counterparty. The idiosyncratic weight represents the company-specific credit risk. The total of the weights for each counterparty (that is, each row) must sum to `1`. The `Weights` input sets the Portfolio property.

For example, if a counterparty’s creditworthiness is composed of 60% US, 20% European, and 20% idiosyncratic, then the `Weights` vector would be ```[0.6 0.2 0.2]```.

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 = creditDefaultCopula(EAD,PD,LGD,Weights,'VaRLevel',0.99)```

expand all

User-defined IDs for counterparties, specified as the comma-separated pair consisting of `'ID'` and a `NumCounterparties`-by-`1` vector of `ID`s for each counterparty. `ID` is used to identify exposures in the `Portfolio` table and the risk contribution table. `ID` must be a numeric, a string array, or a cell array of character vectors. The `ID` name-value pair argument sets the Portfolio property.

If unspecified, `ID` defaults to a numeric vector `1:NumCounterparties`.

Data Types: `double` | `string` | `cell`

Value at risk level (used for reporting `VaR` and `CVaR`), specified as the comma-separated pair consisting of `'VaRLevel'` and a numeric between `0` and `1`. The `VaRLevel` name-value pair argument sets the VaRLevel property.

Data Types: `double`

Factor correlation matrix, specified as the comma-separated pair consisting of `'FactorCorrelation'` and a `NumFactors`-by-`NumFactors` matrix that defines the correlation between the risk factors. The `FactorCorrelation` name-value pair argument sets the FactorCorrelation property.

If not specified, the factor correlation matrix defaults to an identity matrix, meaning that factors are not correlated.

Data Types: `double`

## Properties

expand all

Details of credit portfolio, specified as a MATLAB® table that contains all the portfolio data that was passed as input into `creditDefaultCopula`.

The `Portfolio` table has a column for each of the constructor inputs (`EAD`, `PD`, `LGD`, `Weights`, and `ID`). Each row of the table represents one counterparty.

For example:

``` ID EAD PD LGD Weights __ ______ _________ _______ _________ 1 122.43 0.064853 0.68024 0.3 0.7 2 70.386 0.073957 0.59256 0.3 0.7 3 79.281 0.066235 0.52383 0.3 0.7 4 113.42 0.01466 0.43977 0.3 0.7 5 100.46 0.0042036 0.41838 0.3 0.7```

Data Types: `table`

Correlation matrix for credit factors, specified as a `NumFactors`-by-`NumFactors` matrix. Specify the correlation matrix using the optional name-value pair argument `'FactorCorrelation'` when you create a `creditDefaultCopula` object.

Data Types: `double`

Value at risk level used when reporting VaR and CVaR, specified using an optional name-value pair argument `'VaRLevel'` when you create a `creditDefaultCopula` object.

Data Types: `double`

Total portfolio losses, specified as a `1`-by-`NumScenarios` vector. The `PortfolioLosses` property is empty after you create a `creditDefaultCopula` object. After the `simulate` function is invoked, the `PortfolioLosses` property is populated with the vector of portfolio losses.

Data Types: `double`

## Object Functions

 `simulate` Simulate credit defaults using a creditDefaultCopula object `portfolioRisk` Generate portfolio-level risk measurements `riskContribution` Generate risk contributions for each counterparty in portfolio `confidenceBands` Confidence interval bands `getScenarios` Counterparty scenarios

## Examples

expand 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; ```

Simulate 100,000 scenarios, and view the portfolio risk measures.

``` cdc = simulate(cdc,1e5) portRisk = portfolioRisk(cdc) ```
```cdc = creditDefaultCopula with properties: Portfolio: [100x5 table] FactorCorrelation: [2x2 double] VaRLevel: 0.9900 PortfolioLosses: [1x100000 double] portRisk = 1x4 table EL Std VaR CVaR ______ ______ ______ ______ 24.774 23.693 101.57 120.22 ```

View a histogram of the portfolio losses.

```histogram(cdc.PortfolioLosses); title('Distribution of Portfolio Losses'); ```

For further analysis, use the `simulate`, `portfolioRisk`, `riskContribution`, and `getScenarios` functions with the `creditDefaultCopula` object.

## 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?

Download ebook