DQtest {segMGarch} | R Documentation |
A regression-based test to backtest VaR models proposed by Engle and Manganelli (2004)
Description
Typical VaR tests cannot control for the dependence of violations, i.e., violations may cluster while the overall (unconditional) average of violations is not significantly different from \alpha = 1-VaR
. The conditional expectation should also be zero meaning that Hit_t(\alpha)
is uncorrelated with its own past and other lagged variables (such as r_t
,
r_t^2
or the one-step ahead forecast VaR). To test this assumption, the dynamic conditional quantile (DQ) test is used which involves the following statistic
DQ = Hit^T X(X^T X)^{-1} X^T Hit/ \alpha(1-\alpha)
where X
is the matrix of explanatory variables (e.g., raw and squared past returns) and Hit
the vector collecting Hit_t(\alpha)
. Under the null hypothesis, Engle and Manganelli (2004) show that the proposed
statistic DQ
follows a \chi^2_q
where q = rank(X)
.
Usage
DQtest(y, VaR, VaR_level, lag = 1, lag_hit = 1, lag_var = 1)
## S4 method for signature 'ANY'
DQtest(y, VaR, VaR_level, lag = 1, lag_hit = 1,
lag_var = 1)
Arguments
y |
The time series to apply a VaR model (a single asset rerurn or portfolio return). |
VaR |
The forecast VaR. |
VaR_level |
The VaR level, typically 95% or 99%. |
lag |
The chosen lag for y.Default is 1. |
lag_hit |
The chosen lag for hit. Default is 1. |
lag_var |
The chosen lag for VaR forecasts. Default is 1. |
References
Engle, Robert F., and Simone Manganelli. "CAViaR: Conditional autoregressive value at risk by regression quantiles." Journal of Business & Economic Statistics 22, no. 4 (2004): 367-381.
Examples
#VaR_level=0.95
#y=rnorm(1000,0,4)
#VaR=rep(quantile(y,1-VaR_level),length(y))
#y[c(17,18,19,20,100,101,102,103,104)]=-8
#lag=5
#DQtest(y,VaR,VaR_level,lag)