Main Content


Confidence interval bands



cbTable = confidenceBands(cdc) returns a table of the requested risk measure and its associated confidence bands. confidenceBands is used to investigate how the values of a risk measure and its associated confidence interval converge as the number of scenarios increases. The simulate function must be run before confidenceBands is used. For more information on using a creditDefaultCopula object, see creditDefaultCopula.


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


collapse all

Load saved portfolio data.

load CreditPortfolioData.mat;

Create a 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
          UseParallel: 0
      PortfolioLosses: []

Set the VaRLevel to 99%.

cdc.VaRLevel = 0.99;

Use the simulate function before running confidenceBands. Use confidenceBands with the creditDefaultCopula object to generate the cbTable.

cdc = simulate(cdc,1e5);
cbTable = confidenceBands(cdc,'RiskMeasure','Std','ConfidenceIntervalLevel',0.9); 
ans=10×4 table
    NumScenarios    Lower      Std      Upper 
    ____________    ______    ______    ______

        1000         23.38    24.237    25.166
        2000        23.255    23.859    24.497
        3000        23.617    24.117    24.642
        4000         23.44    23.871    24.319
        5000        23.504    23.891    24.291
        6000        23.582    23.935    24.301
        7000        23.756    24.086    24.426
        8000        23.587    23.893    24.208
        9000        23.582    23.871    24.167
       10000        23.525    23.799    24.079

Input Arguments

collapse all

creditDefaultCopula object obtained after running the simulate function.

For more information on creditDefaultCopula objects, see creditDefaultCopula.

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

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 creditDefaultCopula object

  • 'CVaR' — Conditional VaR at the threshold specified by the VaRLevel property of the creditDefaultCopula 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 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, and is typically much smaller than total number of scenarios simulated. confidenceBands can be used 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 could 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.

Version History

Introduced in R2017a