VaR Duration Test

Description

Implements the VaR Duration Test of Christoffersen and Pelletier.

Usage

1
VaRDurTest(alpha, actual, VaR, conf.level = 0.95)

Arguments

alpha

The quantile (coverage) used for the VaR.

actual

A numeric vector of the actual (realized) values.

VaR

The numeric vector of VaR.

conf.level

The confidence level at which the Null Hypothesis is evaluated.

Details

The duration of time between VaR violations (no-hits) should ideally be independent and not cluster. Under the null hypothesis of a correctly specified risk model, the no-hit duration should have no memory. Since the only continuous distribution which is memory free is the exponential, the test can conducted on any distribution which embeds the exponential as a restricted case, and a likelihood ratio test then conducted to see whether the restriction holds. Following Christoffersen and Pelletier (2004), the Weibull distribution is used with parameter ‘b=1’ representing the case of the exponential. A future release will include the choice of using a bootstrap method to evaluate the p-value, and until then care should be taken when evaluating series of length less than 1000 as a rule of thumb.

Value

A list with the following items:

b

The estimated Weibull parameter which when restricted to the value of 1 results in the Exponential distribution.

uLL

The unrestricted Log-Likelihood value.

rLL

The restricted Log-Likelihood value.

LRp

The Likelihood Ratio Test Statistic.

H0

The Null Hypothesis.

Decision

The on H0 given the confidence level

Author(s)

Alexios Ghalanos

References

Christoffersen, P. and Pelletier, D. 2004, Backtesting value-at-risk: A duration-based approach, Journal of Financial Econometrics, 2(1), 84–108.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
data(dji30ret)
spec = ugarchspec(mean.model = list(armaOrder = c(1,1), include.mean = TRUE),
variance.model = list(model = "gjrGARCH"), distribution.model = "sstd")
fit = ugarchfit(spec, data = dji30ret[1:1000, 1, drop = FALSE])
spec2 = spec
setfixed(spec2)<-as.list(coef(fit))
filt = ugarchfilter(spec2, dji30ret[1001:2500, 1, drop = FALSE], n.old = 1000)
actual = dji30ret[1001:2500,1]
# location+scale invariance allows to use [mu + sigma*q(p,0,1,skew,shape)]
VaR = fitted(filt) + sigma(filt)*qdist("sstd", p=0.05, mu = 0, sigma = 1, 
skew  = coef(fit)["skew"], shape=coef(fit)["shape"])
print(VaRDurTest(0.05, actual, VaR))

# Try with the Normal Distribution (it fails)
spec = ugarchspec(mean.model = list(armaOrder = c(1,1), include.mean = TRUE),
variance.model = list(model = "gjrGARCH"), distribution.model = "norm")
fit = ugarchfit(spec, data = dji30ret[1:1000, 1, drop = FALSE])
spec2 = spec
setfixed(spec2)<-as.list(coef(fit))
filt = ugarchfilter(spec2, dji30ret[1001:2500, 1, drop = FALSE], n.old = 1000)
actual = dji30ret[1001:2500,1]
# location+scale invariance allows to use [mu + sigma*q(p,0,1,skew,shape)]
VaR = fitted(filt) + sigma(filt)*qdist("norm", p=0.05, mu = 0, sigma = 1)
print(VaRDurTest(0.05, actual, VaR))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.