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.


Generate portfolio-level risk measurements


[riskMeasures,confidenceIntervals] = portfolioRisk(cmc)
[riskMeasures,confidenceIntervals] = portfolioRisk(cmc,Name,Value)



[riskMeasures,confidenceIntervals] = portfolioRisk(cmc) returns tables of risk measurements for the portfolio losses. Before you use the portfolioRisk function, run the simulate function. For more information on using a creditMigrationCopula object, see creditMigrationCopula.


[riskMeasures,confidenceIntervals] = portfolioRisk(cmc,Name,Value) adds an optional name-value pair argument for ConfidenceIntervalLevel.


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,...
cmc = 

  creditMigrationCopula with properties:

            Portfolio: [250x5 table]
    FactorCorrelation: [4x4 double]
         RatingLabels: [8x1 string]
     TransitionMatrix: [8x8 double]
             VaRLevel: 0.9500
      PortfolioValues: []

Set the VaRLevel to 99%.

 cmc.VaRLevel = 0.99;

Use the simulate function to simulate 100,000 scenarios, and then use the portfolioRisk function to generate the riskMeasure and ConfidenceIntervals tables.

 cmc = simulate(cmc,1e5);
[riskMeasure,confidenceIntervals] = portfolioRisk(cmc,'ConfidenceIntervalLevel',0.9)
riskMeasure =

  1x4 table

      EL       Std      VaR     CVaR 
    ______    _____    _____    _____

    4573.9    13039    56515    84463

confidenceIntervals =

  1x4 table

           EL                Std               VaR               CVaR     
    ________________    ______________    ______________    ______________

    4506.1    4641.8    12991    13087    55358    57812    82803    86123

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

Example: [riskMeasure,confidenceIntervals] = portfolioRisk(cmc,'ConfidenceIntervalLevel',0.9)

collapse all

Confidence interval level, specified as the comma-separated pair consisting of 'ConfidenceIntervalLevel' and a numeric between 0 and 1. For example, if you specify 0.95, a 95% confidence interval is reported in the output table (riskMeasures).

Data Types: double

Output Arguments

collapse all

Risk measures, returned as a table containing the following columns:

  • EL — Expected loss, the mean of portfolio losses

  • Std — Standard deviation of the losses

  • VaR — Value at risk at the threshold specified by the VaRLevel property of the creditMigrationCopula object

  • CVaR — Conditional VaR at the threshold specified by the VaRLevel property of the creditMigrationCopula object

Confidence intervals, returned as a table of confidence intervals corresponding to the portfolio risk measures reported in the riskMeasures table. Confidence intervals are reported at the level specified by the ConfidenceIntervalLevel parameter.


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