Main Content

creditMigrationCopula

Simulate and analyze multifactor credit migration rating model

Description

The creditMigrationCopula takes as input a portfolio of credit-sensitive positions with a set of counterparties and performs a copula-based, multifactor simulation of credit rating migrations. Counterparty credit rating migrations and subsequent changes in portfolio value are calculated for each scenario and several risk measurements are reported.

creditMigrationCopula associates each counterparty with a random variable, called a latent variable, which is mapped to credit ratings based on a rating transition matrix. For each scenario, the value of the position with each counterparty is recomputed based on the realized credit rating of the counterparty. These latent variables are simulated by using a multifactor model, where systemic credit fluctuations are modeled with a series of risk factors. These factors can be based on industry sectors (such as financial or aerospace), geographical regions (such as USA or 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 are:

  • migrationValues — Values of the counterparty positions for each credit rating.

  • ratings — Current credit rating for each counterparty.

  • transitionMatrix — Matrix of credit rating transition probabilities.

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

  • Weights — Factor and idiosyncratic model weights

After you create creditMigrationCopula object (see Create creditMigrationCopula and Properties), use the simulate function to simulate credit migration by using the multifactor model. Then, for detailed reports, use the following functions: portfolioRisk, riskContribution, confidenceBands, and getScenarios.

Creation

Description

example

cmc = creditMigrationCopula(migrationValues,ratings,transitionMatrix,LGD,Weights) creates a creditMigrationCopula object. The creditMigrationCopula object has the following properties:

  • Portfolio:

    A table with the following variables:

    • ID — ID to identify each counterparty

    • migrationValues — Values of counterparty positions for each credit rating

    • ratings — Current credit rating for each counterparty

    • 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.

  • RatingLabels:

    The set of all possible credit ratings.

  • TransitionMatrix:

    The matrix of probabilities that a counterparty transitions from a starting credit rating to a final credit rating. The rows represent the starting credit ratings and the columns represent the final ratings. The top row holds the probabilities for a counterparty that starts at the highest rating (for example AAA) and the bottom row holds those for a counterparty starting in the default state. The bottom row may be omitted, indicating that a counterparty in default remains in default. Each row must sum to 1. The order of rows and columns must match the order of credit ratings defined in the RatingLabels parameter. The last column holds the probability of default for each of the ratings. If unspecified, the default rating labels are: "AAA","AA","A","BBB","BB","B","CCC","D".

  • VaRLevel:

    The value-at-risk level, used when reporting VaR and CVaR.

  • PortfolioValues:

    A NumScenarios-by-1 vector of portfolio values. This property is empty until you use the simulate function.

example

cmc = creditMigrationCopula(___,Name,Value) sets Properties using name-value pairs and any of the arguments in the previous syntax. For example, cmc = creditMigrationCopula(migrationValues,ratings,transitionMatrix,LGD,Weights,'VaRLevel',0.99). You can specify multiple name-value pairs as optional name-value pair arguments.

Input Arguments

expand all

Values of the counterparty positions for each credit rating, specified as a NumCounterparties-by-NumRatings matrix. Each row holds the possible values of the counterparty position for each credit rating. The last rating must be the default rating. The migrationValues input sets the Portfolio property.

The migration value for the default rating (the last column of migrationValues input) is pre-recovery. This is a reference value (for example, face value, forward value at current rating, or other) that is multiplied by the recovery rate during the simulation to get the value of the asset in the event of default. The recovery rate is defined as 1-LGD, where LGD is specified using the LGD input argument. The LGD is either a constant or a random number drawn from a beta distribution (see the description of the LGD input).

Note

The creditMigrationCopula model simulates the changes in portfolio value over a fixed time period (for example, one year). The migrationValues and transitionMatrix must be specific to a particular time period.

Data Types: double

Current credit rating for each counterparty, specified as a NumCounterparties-by-1 vector that represents the initial credit states. The set of all valid credit ratings and their order is defined by using the optional RatingLabels parameter. The ratings input sets the Portfolio property.

If RatingLabels are unspecified, the default rating labels are: "AAA","AA","A","BBB","BB","B","CCC","D".

Data Types: double | string | cell

Credit rating transition probabilities, specified as a NumRatings-by-NumRatings matrix. The matrix contains the probabilities that a counterparty starting at a particular credit rating transitions to every other rating over some fixed time period. Each row holds all the transition probabilities for a particular starting credit rating. The transitionMatrix input sets the TransitionMatrix property.

The top row holds the probabilities for a counterparty that starts at the highest rating (such as AAA). The bottom row holds the probabilities for a counterparty starting in the default state. The bottom row may be omitted, indicating that a counterparty in default remains in default. Each row must sum to 1.

The order of rows and columns must match the order of credit ratings defined in the RatingLabels parameter. The last column holds the probability of default for each of the ratings. If RatingLabels are unspecified, the default rating labels are: "AAA","AA","A","BBB","BB","B","CCC","D".

Note

The creditMigrationCopula model simulates the changes in portfolio value over a fixed time period (for example, one year). The migrationValues and transitionMatrix must be specific to a particular time period.

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. Then, in the case of default, LGD values are drawn randomly from a beta distribution with provided parameters for the defaulting counterparty.

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)).

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 was composed of 60% US, 20% European, and 20% idiosyncratic, then the Weights vector is [0.6 0.2 0.2].

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 = creditMigrationCopula(migrationValues,ratings,transitionMatrix,LGD,Weights,'VaRLevel',0.99)

User-defined IDs for counterparties, specified as the comma-separated pair consisting of 'ID' and a NumCounterparties-by-1 vector of IDs 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 the factors are not correlated.

Data Types: double

Set of all possible credit ratings, specified as the comma-separated pair consisting of 'RatingLabels' and a NumRatings-by-1 vector, where the first element is the highest credit rating and the last element is the default state. The RatingLabels name-value pair argument sets the RatingLabels property.

Data Types: cell | double | string

Flag to use parallel processing for simulations, specified as the comma-separated pair consisting of 'UseParallel' and a scalar value of true or false. The UseParallel name-value pair argument sets the UseParallel property.

Note

The 'UseParallel' property can only be set when creating a creditMigrationCopula object if you have Parallel Computing Toolbox™. Once the 'UseParallel' property is set, parallel processing is used with riskContribution or simulate.

Data Types: logical

Properties

expand all

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

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

For example:

    ID    MigrationValues    Rating     LGD        Weights   
    __    _______________    ______    ______    ____________

    1     [1x8 double]       "A"       0.6509     0.5     0.5
    2     [1x8 double]       "BBB"     0.8283     0.55    0.45
    3     [1x8 double]       "AA"      0.6041     0.7     0.3
    4     [1x8 double]       "BB"      0.6509     0.55    0.45
    5     [1x8 double]       "BBB"     0.4966     0.75    0.25

Data Types: table

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

Data Types: double

Set of all possible credit ratings, specified using an optional name-value input argument for 'RatingLabels' when you create the creditMigrationCopula object.

Data Types: double | cell | string

Probabilities that a counterparty transitions from a starting credit rating to a final credit rating, specified using the input argument 'transitionMatrix' when you create the creditMigrationCopula object. The rows represent the starting credit ratings and the columns represent the final ratings. The top row corresponds to the highest rating.

The top row holds the probabilities for a counterparty that starts at the highest rating (such as AAA) and the bottom row holds those for a counterparty starting in the default state. The bottom row may be omitted, indicating that a counterparty in default remains in default. Each row must sum to 1.

The order of rows and columns must match the order of credit ratings defined in the RatingLabels parameter. The last column holds the probability of default for each of the ratings. If RatingLabels are unspecified, the default rating labels are: "AAA","AA","A","BBB","BB","B","CCC","D".

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 the creditMigrationCopula object.

Data Types: double

Portfolio values, specified as a 1-by-NumScenarios vector. After creating the creditMigrationCopula object, the PortfolioValues property is empty. After you invoke the simulate function, PortfolioValues is populated with the portfolio values over each scenario.

Data Types: double

Flag to use parallel processing for simulations, specified using an optional name-value pair argument 'UseParallel' when you create a creditMigrationCopula object. The UseParallel name-value pair argument sets the UseParallel property.

Note

The 'UseParallel' property can only be set when creating a creditMigrationCopula object if you have Parallel Computing Toolbox. Once the 'UseParallel' property is set, parallel processing is used with riskContribution or simulate.

Data Types: logical

Object Functions

simulateSimulate credit migrations using creditMigrationCopula object
portfolioRiskGenerate portfolio-level risk measurements
riskContributionGenerate risk contributions for each counterparty in portfolio
confidenceBandsConfidence interval bands
getScenariosCounterparty scenarios

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;

The Portfolio property contains information about migration values, ratings, LGDs and weights.

 head(cmc.Portfolio) 
    ID                                  MigrationValues                                   Rating     LGD                    Weights              
    __    ____________________________________________________________________________    ______    ______    ___________________________________

    1      13301     13280     13216     13082     12421     11939     10180     11700    "A"       0.6509      0       0       0     0.5     0.5
    2       2944      2939    2923.8    2892.6    2737.1      2624    2218.2      3000    "BBB"     0.8283      0    0.55       0       0    0.45
    3     9797.5    9787.9    9754.2    9681.2    9320.5      9050    7976.8      9100    "AA"      0.6041      0     0.7       0       0     0.3
    4     4760.4    4754.3    4735.7    4696.9    4502.7    4359.7    3824.8      4400    "BB"      0.6509      0    0.55       0       0    0.45
    5      10524     10509     10466     10376    9923.5    9591.5    8362.1     10100    "BBB"     0.4966      0       0    0.75       0    0.25
    6     6192.8    6183.2    6154.2    6094.3    5795.1    5576.4    4782.7      6200    "BB"      0.8283      0       0       0    0.65    0.35
    7     5736.9    5727.5    5699.3    5640.7    5349.5    5137.6    4367.4      5200    "BB"      0.6041      0       0       0    0.65    0.35
    8     5065.3    5062.7    5056.4    5038.8    4956.2    4892.2    4491.9      4800    "BB"      0.4873    0.5       0       0       0     0.5

The columns in the migration values are in the same order of the ratings, with the default rating in the last column.

For example, these are the migration values for the first counterparty. Note that the value for default is higher than some of the non-default ratings. This is because the migration value for the default rating is a reference value (for example, face value, forward value at current rating, or other) that is multiplied by the recovery rate during the simulation to get the value of the asset in the event of default. The recovery rate is 1-LGD when the LGD input to creditMigrationCopula is a constant LGD value (the LGD input has one column). The recovery rate is a random quantity when the LGD input to creditMigrationCopula is specified as a mean and standard deviation for a beta distribution (the LGD input has two columns).

bar(cmc.Portfolio.MigrationValues(1,:))
xticklabels(cmc.RatingLabels)
title('Migration Values for First Company')

Use the simulate function to simulate 100,000 scenarios, and then view portfolio risk measures using the portfolioRisk function.

 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)

 portRisk = portfolioRisk(cmc)
portRisk=1×4 table
      EL       Std      VaR     CVaR 
    ______    _____    _____    _____

    4515.9    12963    57176    83975

View a histogram of the portfolio values.

h = histogram(cmc.PortfolioValues,125);
title('Distribution of Portfolio Values');

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 view portfolio risk measures by using the portfolioRisk function.

 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)

 portRisk = portfolioRisk(cmc)
portRisk=1×4 table
      EL       Std      VaR     CVaR 
    ______    _____    _____    _____

    4515.9    12963    57176    83975

View a histogram of the portfolio values.

h = histogram(cmc.PortfolioValues,125);
title('Distribution of Portfolio Values');

Overlay the value that the portfolio takes if all counterparties maintained their current credit ratings.

CurrentRatingValue = portRisk.EL + mean(cmc.PortfolioValues);
     hold on
     plot([CurrentRatingValue CurrentRatingValue],[0 max(h.Values)],...
         'LineWidth',2);
     grid on

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