Main Content

cci

Conditional coverage independence test for value-at-risk (VaR) backtesting

Description

example

TestResults = cci(vbt) generates the conditional coverage independence (CCI) for value-at-risk (VaR) backtesting.

example

TestResults = cci(vbt,Name,Value) adds an optional name-value pair argument for TestLevel.

Examples

collapse all

Create a varbacktest object.

load VaRBacktestData
vbt = varbacktest(EquityIndex,Normal95)
vbt = 
  varbacktest with properties:

    PortfolioData: [1043x1 double]
          VaRData: [1043x1 double]
             Time: [1043x1 double]
      PortfolioID: "Portfolio"
            VaRID: "VaR"
         VaRLevel: 0.9500

Generate the cci test results.

TestResults = cci(vbt)
TestResults=1×13 table
    PortfolioID    VaRID    VaRLevel     CCI      LRatioCCI    PValueCCI    Observations    Failures    N00    N10    N01    N11    TestLevel
    ___________    _____    ________    ______    _________    _________    ____________    ________    ___    ___    ___    ___    _________

    "Portfolio"    "VaR"      0.95      accept     0.25866      0.61104         1043           57       932    53     53      4       0.95   

Use the varbacktest constructor with name-value pair arguments to create a varbacktest object.

load VaRBacktestData
    vbt = varbacktest(EquityIndex,...
       [Normal95 Normal99 Historical95 Historical99 EWMA95 EWMA99],...
       'PortfolioID','Equity',...
       'VaRID',{'Normal95' 'Normal99' 'Historical95' 'Historical99' 'EWMA95' 'EWMA99'},...
       'VaRLevel',[0.95 0.99 0.95 0.99 0.95 0.99])
vbt = 
  varbacktest with properties:

    PortfolioData: [1043x1 double]
          VaRData: [1043x6 double]
             Time: [1043x1 double]
      PortfolioID: "Equity"
            VaRID: ["Normal95"    "Normal99"    "Historical95"    "Historical99"    "EWMA95"    "EWMA99"]
         VaRLevel: [0.9500 0.9900 0.9500 0.9900 0.9500 0.9900]

Generate the cci test results using the TestLevel optional input.

TestResults = cci(vbt,'TestLevel',0.90)
TestResults=6×13 table
    PortfolioID        VaRID         VaRLevel     CCI      LRatioCCI    PValueCCI    Observations    Failures    N00     N10    N01    N11    TestLevel
    ___________    ______________    ________    ______    _________    _________    ____________    ________    ____    ___    ___    ___    _________

     "Equity"      "Normal95"          0.95      accept     0.25866      0.61104         1043           57        932    53     53      4        0.9   
     "Equity"      "Normal99"          0.99      accept     0.56393      0.45268         1043           17       1008    17     17      0        0.9   
     "Equity"      "Historical95"      0.95      accept     0.13847      0.70981         1043           59        928    55     55      4        0.9   
     "Equity"      "Historical99"      0.99      accept     0.27962      0.59695         1043           12       1018    12     12      0        0.9   
     "Equity"      "EWMA95"            0.95      accept    0.040277      0.84094         1043           59        927    56     56      3        0.9   
     "Equity"      "EWMA99"            0.99      accept     0.94909      0.32995         1043           22        998    22     22      0        0.9   

Input Arguments

collapse all

varbacktest (vbt) object, contains a copy of the given data (the PortfolioData and VarData properties) and all combinations of portfolio ID, VaR ID, and VaR levels to be tested. For more information on creating a varbacktest object, see varbacktest.

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: TestResults = cci(vbt,'TestLevel',0.99)

Test confidence level, specified as the comma-separated pair consisting of 'TestLevel' and a numeric between 0 and 1.

Data Types: double

Output Arguments

collapse all

cci test results, returned as a table where the rows correspond to all combinations of portfolio ID, VaR ID, and VaR levels to be tested. The columns correspond to the following information:

  • 'PortfolioID' — Portfolio ID for the given data

  • 'VaRID' — VaR ID for each of the VaR data columns provided

  • 'VaRLevel' — VaR level for the corresponding VaR data column

  • 'CCI' — Categorical array with the categories accept and reject that indicate the result of the cci test

  • 'LRatioCCI' — Likelihood ratio of the cci test

  • 'PValueCCI' — P-value of the cci test

  • 'Observations' — Number of observations

  • 'Failures' — Number of failures

  • 'N00' — Number of periods with no failures followed by a period with no failures

  • 'N10' — Number of periods with failures followed by a period with no failures

  • 'N01' — Number of periods with no failures followed by a period with failures

  • 'N11' — Number of periods with failures followed by a period with failures

  • 'TestLevel' — Test confidence level

Note

For cci test results, the terms accept and reject are used for convenience, technically a cci test does not accept a model. Rather, the test fails to reject it.

More About

collapse all

Conditional Coverage Independence (CCI) Test

The cci function performs the conditional coverage independence test.

This is a likelihood ratio test proposed by Christoffersen (1998) to assess the independence of failures on consecutive time periods. For the conditional coverage mixed test, see the cc function.

Algorithms

To define the likelihood ratio (test statistic) of the cc test, first define the following quantities:

  • 'N00' — Number of periods with no failures followed by a period with no failures

  • 'N10' — Number of periods with failures followed by a period with no failures

  • 'N01' — Number of periods with no failures followed by a period with failures

  • 'N11' — Number of periods with failures followed by a period with failures

Then define the following conditional probability estimates:

  • p01 = Probability of having a failure on period t, given that there was no failure on period t - 1

    p01= N01(N00 + N01) 

  • p11 = Probability of having a failure on period t, given that there was a failure on period t - 1

    p11= N11(N10 + N11) 

Define also the unconditional probability estimate of observing a failure:

pUC = Probability of having a failure on period t

pUC= (N01 + N11)(N00 + N01 + N10 + N11) 

The likelihood ratio of the CCI test is then given by

LRatioCCI=2log((1pUC)N00+N10pUCN01+N11(1p01)N00p01N01(1p11)N10p11N11)=2((N00+N10)log(1pUC)+(N01+N11)log(pUC)N00 log(1p01)N01 log(p01)N10 log(1p11)N11 log(p11))

which is asymptotically distributed as a chi-square distribution with 1 degree of freedom.

The p-value of the CCI test is the probability that a chi-square distribution with 1 degree of freedom exceeds the likelihood ratio LRatioCCI,

PValueCCI= 1 - F(LRatioCCI)

where F is the cumulative distribution of a chi-square variable with 1 degree of freedom.

The result of the test is to accept if

F(LRatioCCI)<F(TestLevel)

and reject otherwise, where F is the cumulative distribution of a chi-square variable with 1 degree of freedom.

If one or more of the quantities N00, N10, N01, or N11 are zero, the likelihood ratio is handled differently. The likelihood ratio as defined above is composed of three likelihood functions of the form

L=(1p)n1×pn2

For example, in the numerator of the likelihood ratio, there is a likelihood function of the form L with p = pUC, n1 = N00 + N10, and n2 = N01 + N11. There are two such likelihood functions in the denominator of the likelihood ratio.

It can be shown that whenever n1 = 0 or n2 = 0, the likelihood function L is replaced by the constant value 1. Therefore, whenever N00, N10, N01, or N11 is zero, replace the corresponding likelihood functions by 1 in the likelihood ratio, and the likelihood ratio is well-defined.

References

[1] Christoffersen, P. "Evaluating Interval Forecasts." International Economic Review. Vol. 39, 1998, pp. 841 – 862.

Version History

Introduced in R2016b