[R-SIG-Finance] rugarch package / VaR Duration Test / Size Property
TobiB
tobias.berens at gmx.net
Thu Mar 14 17:34:12 CET 2013
Hi,
I want to assess the size properties of the duration based VaR backtest of
Christoffersen and Pelletier (2004) by simulating i.i.d. Bernoulli variables
and using the function VaRDurTest() of the rugarch package. I am aware that
the size property is bad when evaluating small series, but even for a series
length of e.g. 10,000 I do not achieve the accurate significance level.
Furthermore, the size property become worse if the series length increases.
Has anybody an idea, what I have done wrong?
I use the following code for the evaluation:
library(rugarch)
VaR.quantile = 0.05 #VaR quantile
fc.period = 10000 #Length Forecasting-Period
n.sim = 10000 #Number of simulations
DurTest.p = rep(0,n.sim)
test=0
outlier=0
i=0
while (test<n.sim)
{
return.vec = (-1)*rbinom(fc.period,1,VaR.quantile) #Return vector
var <- rep(-0.5,fc.period)
#VaR vector
if (sum(return.vec)< -1)
#Exclude ouliers (sum of VaR violations<2)
{
test = test+1
DurTest.p[test] = VaRDurTest(alpha = VaR.quantile, actual = return.vec,
VaR = var, conf.level = 0.95)$LRp
} else {outlier = outlier+1}
i=i+1
print(c(i,test,outlier))
}
rbind(
res.DurTest.001 = length(which(DurTest.p<=0.001))/test,
res.DurTest.01 = length(which(DurTest.p<=0.01))/test,
res.DurTest.05 = length(which(DurTest.p<=0.05))/test,
res.DurTest.10 = length(which(DurTest.p<=0.10))/test)
#
The application of this code leads to the following results:
res.DurTest.001 0.0715 # 0.1% Level
res.DurTest.01 0.2437 # 1% Level
res.DurTest.05 0.4953 # 5% Level
res.DurTest.10 0.6274 # 10% Level
Instead of using the code
return.vec = (-1)*rbinom(fc.period,1,VaR.quantile) #Return vector
var <- rep(-0.5,fc.period)
#VaR vector
to simulate an i.i.d Bernoulli distributed hit sequence, I also tried
return.vec = rnorm(fc.period,0,0.1)
var = rep(qnorm(VaR.quantile,0,0.1),fc.period)
However, the results are the same.
Thanks in advance.
TB
--
View this message in context: http://r.789695.n4.nabble.com/rugarch-package-VaR-Duration-Test-Size-Property-tp4661373.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list