Generate risk contributions for each counterparty in portfolio
Contributions = riskContribution(cdc)
returns a table of risk contributions for each counterparty in the portfolio.
Contributions = riskContribution(
Contributions table allocates the full portfolio
risk measures to each counterparty, such that the counterparty risk
contributions sum to the portfolio risks reported by
Load saved portfolio data.
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: 
VaRLevel to 99%.
cdc.VaRLevel = 0.99;
function before running
riskContribution. Then use
riskContribution with the
creditDefaultCopula object to generate the risk
cdc = simulate(cdc,1e5); 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
Contributions— Risk contributions
Risk contributions, returned as a table containing the following risk contributions for each counterparty:
EL — Expected loss for the
particular counterparty over the scenarios
CVaR — Conditional value at risk
for the particular counterparty over the scenarios
Contributions table allocates the full
portfolio risk measures to each counterparty, such that the counterparty
risk contributions sum to the portfolio risks reported by
 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.
 Glasserman, P. “Measuring Marginal Risk Contributions in Credit Portfolios.” Journal of Computational Finance. Vol. 9, No. 2, Winter 2005/2006.
 Gordy, M. “A Comparative Anatomy of Credit Risk Models.” Journal of Banking and Finance. Vol. 24, 2000, pp. 119–149.
 Gupton, G., Finger, C., and Bhatia, M. “CreditMetrics – Technical Document.” J. P. Morgan, New York, 1997.
 Jorion, P. Financial Risk Manager Handbook. 6th Edition. Wiley Finance, 2011.
 Kalkbrener, M., Lotter, H., and Overbeck, L. “Sensible and Efficient Capital Allocation for Credit Portfolios.” Risk. 17, 2004, pp. S19–S24.
 Löffler, G., and Posch, P. Credit Risk Modeling Using Excel and VBA. Wiley Finance, 2007.
 McNeil, A., Frey, R., and Embrechts, P. Quantitative Risk Management: Concepts, Techniques, and Tools. Princeton University Press, 2005.