This is machine translation

Translated by Microsoft
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.


Confidence interval bands


cbTable = confidenceBands(cmc)
cbTable = confidenceBands(cmc,Name,Value)



cbTable = confidenceBands(cmc) returns a table of the requested risk measure and its associated confidence bands. Use confidenceBands to investigate how the values of a risk measure and its associated confidence interval converge as the number of scenarios increases. Before you run the confidenceBands function, you must run the simulate function. For more information on using a creditMigrationCopula object, see creditMigrationCopula.


cbTable = confidenceBands(cmc,Name,Value) adds optional name-value pair arguments.


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 confidenceBands function to generate the cbTable.

cmc = simulate(cmc,1e5);
cbTable = confidenceBands(cmc,'RiskMeasure','Std','ConfidenceIntervalLevel',0.9,'NumPoints',50);
ans =

  10x4 table

    NumScenarios    Lower     Std     Upper
    ____________    _____    _____    _____

     2000           12297    12616    12954
     4000           12512    12741    12980
     6000           12211    12395    12584
     8000           12236    12395    12559
    10000           12537    12683    12832
    12000           12447    12579    12714
    14000           12495    12618    12743
    16000           12574    12689    12807
    18000           12650    12759    12871
    20000           12780    12885    12992

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: cbTable = confidenceBands(cmc,'RiskMeasure','Std','ConfidenceIntervalLevel',0.9,'NumPoints',50)

collapse all

Risk measure to investigate, specified as the comma-separated pair consisting of 'RiskMeasure' and a character vector or string. Possible values are:

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

Data Types: char | string

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

Data Types: double

Number of scenario samples to report, specified as the comma-separated pair consisting of 'NumPoints' and a nonnegative integer. The default is 100, meaning that confidence bands are reported at 100 evenly spaced points of increasing sample size ranging from 0 to the total number of simulated scenarios.


NumPoints must be a numeric scalar greater than 1. NumPoints is typically much smaller than total number of scenarios simulated. You can use confidenceBands to obtain a qualitative idea of how fast a risk measure and its confidence interval are converging. Specifying a large value for NumPoints is not recommended and can potentially cause performance issues with confidenceBands.

Data Types: double

Output Arguments

collapse all

Requested risk measure and associated confidence bands at each of the NumPoints scenario sample sizes, returned as a table containing the following columns:

  • NumScenarios — Number of scenarios at the sample point

  • Lower — Lower confidence band

  • RiskMeasure — Requested risk measure, where the column takes its name from whatever risk measure is requested with the optional input RiskMeasure

  • Upper — Upper confidence band


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