covtest {ufRisk}R Documentation

Unconditional and Conditional Coverage Tests, Independence Test

Description

The conditional (Kupiec, 1995), the unconditional coverage test (Christoffersen, 1998) and the independence test (Christoffersen, 1998) of the Value-at-Risk (VaR) can be applied.

Usage

covtest(obj = list(Loss = NULL, VaR = NULL, p = NULL), conflvl = 0.95)

Arguments

obj

a list that contains the following elements:

Loss

a numeric vector that contains the values of a loss series ordered from past to present; is set to NULL by default.

VaR

a numeric vector that contains the estimated values of the VaR for the same time points of the loss series Loss; is set to NULL by default.

p

a numeric vector with one element; defines the probability p stated in the null hypotheses of the coverage tests (see the section Details for more information); is set to NULL by default.

conflvl

a numeric vector with one element; the significance level at which the null hypotheses are evaluated; is set to 0.95 by default. Please note that a list returned by the varcast function can be directly passed to covtest.

Details

With this function, the conditional and the unconditional coverage tests introduced by Kupiec (1995) and Christoffersen (1998) can be applied. Given a return series rtr_t with nn observations, divide the series into nKn-K in-sample and KK out-of-sample observations, fit a model to the in-sample data and obtain rolling one-step forecasts of the VaR for the out-of-sample time points.

Define

It=1,I_t = 1,

if rt>VaR^t(α)-r_t > \widehat{VaR}_t (\alpha) or

It=0,I_t = 0,

otherwise,

for t=n+1,n+2,...,n+Kt = n + 1, n + 2, ..., n + K as the hit sequence, where α\alpha is the confidence level for the VaR (often α=0.95\alpha = 0.95 or α=0.99\alpha = 0.99). Furthermore, denote p=αp = \alpha and let ww be the actual covered proportion of losses in the data.

1. Unconditional coverage test:

H0,uc:p=wH_{0, uc}: p = w

Let K1K_1 be the number of ones in ItI_t and analogously K0K_0 the number of zeros (all conditional on the first observation). Also calculate w^=K0/(K1)\hat{w} = K_0 / (K - 1). Obtain

L(It,p)=pK0(1p)K1L(I_t, p) = p^{K_0}(1 - p)^{K_1}

and

L(It,w^)=w^K0(1w^)K1L(I_t, \hat{w}) = \hat{w}^{K_0}(1 - \hat{w})^{K_1}

and subsequently the test statistic

LRuc=2ln{L(It,p)/L(It,w^)}.LR_{uc} = -2 * \ln \{L(I_t, p) / L(I_t, \hat{w})\}.

LRucLR_{uc} now asymptotically follows a chi-square-distribution with one degree of freedom.

2. Conditional coverage test:

The conditional coverage test combines the unconditional coverage test with a test on independence. Denote by wijw_{ij} the probability of an ii on day t1t-1 being followed by a jj on day tt, where ii and jj correspond to the value of ItI_t on the respective day.

H0,cc:w00=w10=pH_{0, cc}: w_{00} = w{10} = p

with i=0,1i = 0, 1 and j=0,1j = 0, 1.

Let KijK_{ij} be the number of observations, where the values on two following days follow the pattern ijij. Calculate

L(It,w^00,w^10)=w^00K00(1w^00)K01w^10)K10(1w^10)K11,L(I_t, \hat{w}_{00}, \hat{w}_{10}) = \hat{w}_{00}^{K_{00}}(1 - \hat{w}_{00})^{K_{01}} * \hat{w}_{10})^{K_{10}}(1 - \hat{w}_{10})^{K_{11}},

where w^00=K00/K0\hat{w}_{00} = K_{00} / K_0 and w^10=K10/K1\hat{w}_{10} = K_{10} / K_1. The test statistic is then given by

LRcc=2ln{L(It,p)/L(It,w^00,w^10)},LR_{cc} = -2 * \ln \{ L(I_t, p) / L(I_t, \hat{w}_{00}, \hat{w}_{10}) \},

which asymptotically follows a chi-square-distribution with two degrees of freedom.

3. Independence test:

H0,ind:w00=w10H_{0,ind}: w_{00} = w_{10}

The asymptotically chi-square-distributed test statistic (one degree of freedom) is given by

LRind=2ln{L(It,w^00,w^10)/L(It,w^)}.LR_{ind} = -2 * \ln \{L(I_t, \hat{w}_{00}, \hat{w}_{10}) / L(I_t, \hat{w})\}.

—————————————————————————–

The function needs four inputs: the out-of-sample loss series obj$Loss, the corresponding estimated VaR series obj$VaR, the coverage level obj$p, for which the VaR has been calculated and the significance level conflvl, at which the null hypotheses are evaluated. If an object returned by this function is entered into the R console, a detailed overview of the test results is printed.

Value

A list of class ufRisk with the following four elements:

p

probability p stated in the null hypotheses of the coverage tests.

p.uc

the p-value of the unconditional coverage test.

p.cc

the p-value of the conditional coverage test.

p.ind

the p-value of the independence test.

conflvl

the significance level at which the null hypotheses are evaluated.

Author(s)

References

Christoffersen, P. F. (1998). Evaluating interval forecasts. International economic review, pp. 841-862.

Kupiec, P. (1995). Techniques for verifying the accuracy of risk measurement models. The J. of Derivatives, 3(2).

Examples



# Example for Walmart Inc. (WMT)
prices <- WMT$price.close
output <- varcast(prices)
Loss <- -output$ret.out
VaR <- output$VaR.v
covtest.data <- list(Loss = Loss, VaR = VaR, p = 0.99)
covtest(covtest.data)

# directly passing an output object of 'varcast()' to 'covtest()'
output <- varcast(prices)
covtest(output)


[Package ufRisk version 1.0.7 Index]