riskContribution

Generate risk contributions for each counterparty in portfolio

Syntax

Contributions = riskContribution(cmc)
Contributions = riskContribution(cmc,Name,Value)

Description

example

Contributions = riskContribution(cmc) returns a table of risk contributions for each counterparty in the portfolio. The risk Contributions table allocates the full portfolio risk measures to each counterparty, such that the counterparty risk contributions sum to the portfolio risks reported by portfolioRisk.

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

Before you use the riskContribution function, you must run the simulate function. For more information on using a creditMigrationCopula object, see creditMigrationCopula.

example

Contributions = riskContribution(cmc,Name,Value) adds an optional name-value pair argument for VaRWindow.

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, and then use the riskContribution function to generate the Contributions table.

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

     1    16.397    40.977    192.11    254.12
     2    9.1179    21.417      83.3    134.31
     3    5.7873    24.887    99.573    236.84
     4    6.4235     57.71    192.06    338.23
     5    22.739    72.371    289.12    544.69
     6    10.776    111.12    327.96    704.29
     7    2.9046     88.98    324.91     551.4
     8    12.152    42.123    189.38    265.97
     9    2.1567    4.0432    3.2359    26.112
    10    1.7495    2.4593    11.003    15.933

Input Arguments

collapse all

creditMigrationCopula object obtained after running the simulate function.

For more information on creditMigrationCopula objects, see creditMigrationCopula.

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 quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: Contributions = riskContribution(cmc,'VaRWindow',0.3)

Size of the window used to compute VaR contributions, specified as the comma-separated pair consisting of 'VaRWindow' and a scalar numeric with a percent value. Scenarios in the VaR scenario set are used to calculate the individual counterparty VaR contributions.

The default is 0.05, meaning that all scenarios with portfolio losses within 5 percent of the VaR are included when computing counterparty VaR contributions.

Data Types: double

Output Arguments

collapse all

Risk contributions, returned as a table containing the following risk contributions for each counterparty:

  • EL — Expected loss for the particular counterparty over the scenarios

  • Std — Standard deviation of loss for the particular counterparty over the scenarios

  • VaR — Value at risk for the particular counterparty over the scenarios

  • CVaR — Conditional value at risk for the particular counterparty over the scenarios

The risk Contributions table allocates the full portfolio risk measures to each counterparty, such that the counterparty risk contributions sum to the portfolio risks reported by portfolioRisk.

More About

collapse all

Risk Contributions

The riskContribution function reports the individual counterparty contributions to the total portfolio risk measures using four risk measures: expected loss (EL), standard deviation (Std), VaR, and CVaR.

  • EL is the expected loss for each counterparty and is the mean of the counterparty's losses across all scenarios.

  • Std is the standard deviation for counterparty i:

    StdConti=StdijStdjρijStdρ

    where

    Stdi is the standard deviation of losses from counterparty i.

    Stdρ is the standard deviation of portfolio losses.

    ρij is the correlation of the losses between counterparties i and j.

  • VaR contribution is the mean of a counterparty’s losses across all scenarios in which the total portfolio loss is within some small neighborhood around the Portfolio VaR. The default of the ‘VaRWindow’ parameter is 0.05 meaning that all scenarios in which the total portfolio loss is within 5% of the portfolio VaR are included in VaR neighborhood.

  • CVaR is the mean of the counterparty’s losses in the set of scenarios in which the total portfolio losses exceed the portfolio VaR.

References

[1] Glasserman, P. “Measuring Marginal Risk Contributions in Credit Portfolios.” Journal of Computational Finance. Vol. 9, No. 2, Winter 2005/2006.

[2] Gupton, G., Finger, C., and Bhatia, M. “CreditMetrics – Technical Document.” J. P. Morgan, New York, 1997.

Introduced in R2017a