[R-SIG-Finance] rugarch package / VaR Duration Test / Size Property

alexios ghalanos alexios at 4dscape.com
Fri Mar 15 14:51:24 CET 2013


Not sure.

I tested the code yesterday against a couple of other publicly available 
implementations online, so I assume that this is not the problem, but 
feel free to look at the underlying code to check.

I've also run the test based on one of their other papers
(http://www4.ncsu.edu/~dpellet/papers/BCP_23Jun08.pdf) which does
a size test with iid Bernoulli  and find similar results (they use
sample sizes of 250-1500).

A proper full test (code below) for different coverage levels and sizes 
gives the following results:

             Coverage[0.01] Coverage[0.025] Coverage[0.05] Coverage[0.1]
Size[250]        0.2012009       0.1624248         0.1350        0.2007
Size[500]        0.1762988       0.1287000         0.1419        0.2871
Size[1000]       0.1304000       0.1131000         0.1657        0.4448
Size[2500]       0.1130000       0.1224000         0.2559        0.7502
Size[5000]       0.1082000       0.1458000         0.3955        0.8898
Size[10000]      0.1091000       0.1949000         0.6229        0.9110


The table reports the percent rejections at the 10% level of 
significance. What is expected, is that as the size grows, the 
rejections converge to 10% (since the underlying DGP is 'correct'). This 
is the case with 1% coverage....but not for higher rates. Don't really 
know why...slightly suspect it may be related to the numerical 
calculation of the Weibull shape parameter (beta) and the relationship 
with the scale (alpha) given in Equation (29) of the original paper, but 
I may be wrong. If you develop more insights into the reasons, do share 
them with the list.


-Alexios

#######################################
# take care with the cluster size since
# A is quite large and you may run out of RAM
library(rugarch)
alpha = c(0.01, 0.025, 0.05, 0.1)
n = c(250, 500, 1000, 2500, 5000, 10000)
sim = 10000
size_table = matrix(NA, 6, 4)
cl = makePSOCKcluster(5)
clusterEvalQ(cl, library(rugarch))
for(j in 1:4){
   A = matrix((-1)*rbinom(10000*sim,1,alpha[j]), 10000, sim)
   clusterExport(cl, c("A"))
   for(i in 1:6){
       clusterExport(cl, c("alpha", "n", "i", "j"))
       tmp = parApply(cl, A, 2, FUN = function(x){
       ans=try(VaRDurTest(alpha[j], x[1:n[i]], rep(-0.5,n[i]))$LRp, 
silent=TRUE)
       if(inherits(ans, 'try-error')) ans=NA
       return(ans)})
       tmp = na.omit(tmp)
       size_table[i,j] = length(which(tmp<=0.1))/length(tmp)
   }
}
rownames(size_table)=paste("Size[",n,"]",sep="")
colnames(size_table)=paste("Coverage[",alpha,"]",sep="")
#########################################

On 15/03/2013 10:46, TobiB wrote:
> Thank you for the quick response.
>
> I tried a higher number of simulations (n.sim = 20,000). The results remain
> unchanged:
>
> res.DurTest.001 0.07050 # 0.1% Level
> res.DurTest.01  0.25005 # 1% Level
> res.DurTest.05  0.48870 # 5% Level
> res.DurTest.10  0.61850 # 10% Level
>
> If the length of the tested forecast-period is increased to fc.period =
> 20,000, the results become even worse:
>
> res.DurTest.001 0.2660 # 0.1% Level
> res.DurTest.01  0.5534 # 1% Level
> res.DurTest.05  0.7736 # 5% Level
> res.DurTest.10  0.8486 # 10% Level
>
> You can replicate these results by using the codes above.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/rugarch-package-VaR-Duration-Test-Size-Property-tp4661373p4661452.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>



More information about the R-SIG-Finance mailing list