[R-SIG-Finance] RUGARCH VaRTest problem and a Question wrt UGARCHFIT

alexios ghalanos alexios at 4dscape.com
Thu Dec 19 17:38:12 CET 2013


1. The VaRTest was changed some time ago to deal with a specific case
which degenerates and leads to evaluation of log(0). Unfortunately, in
my attempt to deal with this the results in this case are wrong. I'll
reverse the fix and you will get NaN for this case (as before). Feel
free to look at the underlying code and suggest an alternative (the
offending code is the ".Log" function in the 'rugarch-tests.R' file).

2. The documentation example has the error. VaR should be transformed to
numeric as per the documentation inputs (the difference in the results
is because the underlying code uses certain logic statements which do
not work for an xts object).

3. The shape is the d.o.f. parameter. It has a default upper bound of
60, but per previous discussions here, you can change that to anything
else you want (use the 'setbounds<-' method on a specification object
prior to estimation).

4. Skew and Shape are the same as in Fernandez and Steel. Only thing
that changes is the reparametrization of the distribution to one where
mu=mean, sigma=stdev. A good way to get a feel of the distribution is by
looking at its moments for different parameters via numerical integration:
e.g.
f2 = function(x) x^2*ddist("sstd",x, 0, 1, skew=1, shape=60)
f3 = function(x) x^3*ddist("sstd",x, 0, 1, skew=1, shape=60)
f4 = function(x) x^4*ddist("sstd",x, 0, 1, skew=1, shape=60)
integrate(f2, -Inf, Inf)
integrate(f3, -Inf, Inf)
integrate(f4, -Inf, Inf)

-Alexios

On 19/12/2013 15:08, Johannes Moser wrote:
> Dear R-Users and Contributors,
> 
> I`m using the rugarch package for a project at university and I must say this is a really fine package!
> There are, however, two questions that I could not answer reading the documentation and browsing the internet:
> 
> The first regards the VaRTest function:
> When plugging my own numeric data vectors into this function, the test seems not to work well.
> No matter how bad the VaR-estimates are (clustered VaR breaches, many VaR breaches, both combined),
> the H0 of both tests (conditional coverage and unconditional coverage) is not rejected.
> 
> For instance I get the following:
> 
> $expected.exceed
> [1] 489
> 
> $actual.exceed
> [1] 2807
> 
> $uc.H0
> [1] "Correct Exceedances"
> 
> $uc.LRstat
> [1] 0
> 
> $uc.critical
> [1] 3.841459
> 
> $uc.LRp
> [1] 1
> 
> $uc.Decision
> [1] "Fail to Reject H0"
> 
> $cc.H0
> [1] "Correct Exceedances & Independent"
> 
> $cc.LRstat
> [1] 0
> 
> $cc.critical
> [1] 5.991465
> 
> $cc.LRp
> [1] 1
> 
> $cc.Decision
> [1] "Fail to Reject H0"
> 
> The documentation says, that the function takes two numeric vectors.
> 
> However, the example from the documentation (? VaRTest) uses a different object:
> class(VaR)
> [1] "xts" "zoo"
> 
> *Does the VaR-function need an xts formatted object?
> If so, which of the arguments (actual or VaR) or just any?*
> 
> When transforming the xts-VaR-object from the example to a simple numeric vector,
> the test result of the CC-test changes!
> E.g. run this after running the example to see the differences:
> print(VaRTest(0.05, actual, as.numeric(VaR[,1]) ))
> 
> 
> 
> 
> My second question refers to the range of the shape parameter using ugarchfit
> with (eGARCH and) a skewed student t distribution.
> I`ve created a series of vola forecasts the following way:
> 
> I reestimated an eGARCH-model every 5 working days, starting with a
> increasing sample of 500 obs at the beginning (then 505, 510 etc.).
> After each estimation step, I generated 5 rolling 1-step-ahead forcasts (n.roll=4)
> from each of the estimated models, thereby creating a continuous stream
> of forecasts. (I can provide the code if this is of any help)
> 
> The maximum value for the estimated shape parameter is 60 and in 2058 estimates
> it reaches this bound only 3 times, but the plot still looks kind of truncated:
> 
> http://www.file-upload.net/download-8420593/mod4_para8.pdf.html
> 
> Does this point to a programming error of mine? Or*is there a upper limit in**the**
> **ugarchfit function wrt the range of the shape parameter*  (in the spirit of "a shape of
> 60 is close to a normal distribution and therefore the modelling of the student t is not
> supported any more"?)
> 
> By the way, is the shape parameter in this case the degrees of freedom or something else?
> Is the skew parameter of the skewed t distribution the same thing as in Fernandez_Steel_1998?
> I heared that some people have reparametrized the skewed t distribution once more so that
> the parameters actually correspond to the moments (which is not the case in F.&S.).
> I have looked for these questions in the documentation without finding an answer.
> Hopefully I have not overseen anything?
> 
> This is my first posting to this list and I hope that I have met the etiquette.
> 
> Thanks in advance for your effort to help me!
> Best,
> Johannes
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> 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