The conditional (Kupiec, 1995), the unconditional coverage test (Christoffersen, 1998) and the independence test (Christoffersen, 1998) of the Value-at-Risk (VaR) are applied.
cvgtest(obj = list(loss = NULL, VaR = NULL, p = NULL), conflvl = 0.95)
A list of class quarks
with the following four elements:
probability p stated in the null hypotheses of the coverage tests
the p-value of the unconditional coverage test
the p-value of the conditional coverage test
the p-value of the independence test
the significance level at which the null hypotheses are evaluated
selected model for estimation; only available if a list
returned by the rollcast
function is passed to cvgtest
selected method for estimation; only available if a list
returned by the rollcast
) function is passed to cvgtest
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.
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 rollcast
function can be directly
passed to cvgtest
.
With this function, the conditional and the unconditional coverage tests introduced by Kupiec (1995) and Christoffersen (1998) can be applied. Given a return series \(r_t\) with \(n\) observations, divide the series into \(n-K\) in-sample and \(K\) 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
$$I_t = 1,$$
if \(-r_t > \widehat{VaR}_t (\alpha)\) or
$$I_t = 0,$$ otherwise,
for \(t = n + 1, n + 2, ..., n + K\) as the hit sequence, where \(\alpha\) is the confidence level for the VaR (often \(\alpha = 0.95\) or \(\alpha = 0.99\)). Furthermore, denote \(p = \alpha\) and let \(w\) be the actual covered proportion of losses in the data.
1. Unconditional coverage test:
$$H_{0, uc}: p = w$$
Let \(K_1\) be the number of ones in \(I_t\) and analogously \(K_0\) the number of zeros (all conditional on the first observation). Also calculate \(\hat{w} = K_0 / (K - 1)\). Obtain
$$L(I_t, p) = p^{K_0}(1 - p)^{K_1}$$
and
$$L(I_t, \hat{w}) = \hat{w}^{K_0}(1 - \hat{w})^{K_1}$$
and subsequently the test statistic
$$LR_{uc} = -2 * \ln \{L(I_t, p) / L(I_t, \hat{w})\}.$$
\(LR_{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 \(w_{ij}\) the probability of an \(i\) on day \(t-1\) being followed by a \(j\) on day \(t\), where \(i\) and \(j\) correspond to the value of \(I_t\) on the respective day.
$$H_{0, cc}: w_{00} = w{10} = p$$
with \(i = 0, 1\) and \(j = 0, 1\).
Let \(K_{ij}\) be the number of observations, where the values on two following days follow the pattern \(ij\). Calculate
$$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 \(\hat{w}_{00} = K_{00} / K_0\) and \(\hat{w}_{10} = K_{10} / K_1\). The test statistic is then given by
$$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:
$$H_{0,ind}: w_{00} = w_{10}$$
The asymptotically chi-square-distributed test statistic (one degree of freedom) is given by
$$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.
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).
prices <- DAX$price_close
returns <- diff(log(prices))
n <- length(returns)
nout <- 250 # number of obs. for out-of-sample forecasting
nwin <- 500 # window size for rolling forecasts
results <- rollcast(x = returns, p = 0.975, method = 'age', nout = nout,
nwin = nwin)
cvgtest(results)
Run the code above in your browser using DataLab