[R-SIG-Finance] Error in rugarch ACF squared standardized residuals plot

Jen Bohold jenbohold at yahoo.de
Wed May 22 09:10:39 CEST 2013


Although it seems that there is no feedback and you do not want to comment on me, I thought I should share this to the list, maybe someone else is some time wondering about this (maybe I did a mistake, but no one of the list or you told me in the previous mail). Also, I do not want to offend you, I like your package it's great! Especially I liked the acf plots, they have a better design, although 
you will see in the following text, that the "ACF of Squared Standadrized Residuals" plot are not useable anymore. 


The plot of the ACF of the squared standardized residuals in rugarch output (you get it via plot(yourmodel) and choosing number 11) is wrong.
However, the corresponding Q-Statistics of the rugarch output are correct!

Consider the following (I attached my data and the plots). I fitted the following model (output extracted to the relevant parts):

*---------------------------------*
*          GARCH Model Fit*
*---------------------------------*

Conditional Variance Dynamics     
-----------------------------------
GARCH Model    : sGARCH(1,1)
Mean Model    : ARFIMA(5,0,5)
Distribution    : norm 

Optimal Parameters
------------------------------------
        Estimate  Std. Error  t value Pr(>|t|)
ar1     0.000000          NA       NA       NA
ar2     0.000000          NA       NA       NA
ar3     0.000000          NA       NA       NA
ar4    -0.292207    0.019550 -14.9467  0.0e+00
ar5    -0.745887    0.018488 -40.3436  0.0e+00
ma1     0.000000          NA       NA       NA
ma2     0.000000          NA       NA       NA
ma3     0.000000          NA       NA       NA
ma4     0.309446    0.026659  11.6073  0.0e+00
ma5     0.718856    0.021208  33.8952  0.0e+00
omega   0.000006    0.000001   4.2106  2.5e-05
alpha1  0.093397    0.011308   8.2591  0.0e+00
beta1   0.892404    0.012437  71.7563  0.0e+00


Q-Statistics on Standardized Residuals
------------------------------------
                         statistic    p-value
Lag[1]                 7.898       4.949e-03
Lag[p+q+1][11]    21.627     3.312e-06
Lag[p+q+5][15]    27.133     5.374e-05
d.o.f=10
H0 : No serial correlation

Q-Statistics on Standardized Squared Residuals
------------------------------------
                        statistic  p-value
Lag[1]               1.274     0.258961
Lag[p+q+1][3]     9.351    0.002229
Lag[p+q+5][7]    12.135    0.032980
d.o.f=2
As you can see in the "Q-Statistics on Standardized Squared Residuals" there is clearly correlation in the standardized squared residuals. BUT if you look at the plot with the plot method and choosing number 11 you can see, that NO spike is significant.

This plot is not correct, I controlled it via the Acf plot of the forecast package and clearly, the spikes are larger! So the second spike is now significant. I control the calculations via the Box.test method using d.o.f.=2 and choosing the lag 3 and 7 and the calculations in the rugarch package are correct! So the p-values are indeed 0.002229 and 0.032980. So why is the plot of the rugarch package wrong?

One further notice: In a previous mail, I asked, why the lags in the Q-Statistics on Standardized Squared Residuals are different to the lags used in Q-Statistics on Standardized Residuals. Of course, I have now seen, that the second uses the GARCH parameters, so it is clear, that this has to be equal to two (1+1). I also have to say, that I think, that the ACF of observations plot e.g. is indeed correct (number 4), so it seems, that the plot number 11 uses different scaled residuals? Maybe it uses the non-standardized squared residuals? Could that be the reason?

Thanks a lot for your notice.
My code:

library(rugarch)
modsp<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)), 
mean.model = list(armaOrder = c(5, 5), include.mean = FALSE), 
distribution.model = "norm",fixed.pars=list(ar1=0,ar2=0,ar3=0,ma1=0,ma2=0,ma3=0))

modgarch<-ugarchfit(spec=modsp,data=mydata)
plot(modgarch)


residuals(mydata,standardize=TRUE)
resdi<-as.numeric(residuals(mydata,standardize=TRUE))

library(forecast)
Acf(resdi^2)

Box.test(resdi^2, lag = 3, type = "Ljung-Box", fitdf = 2)
Box.test(resdi^2, lag = 7, type = "Ljung-Box", fitdf = 2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mydatagarch.RData
Type: application/octet-stream
Size: 27552 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130522/78795877/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rugarchoutput.PNG
Type: image/png
Size: 17372 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130522/78795877/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forecastoutput.PNG
Type: image/png
Size: 10868 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130522/78795877/attachment-0001.png>


More information about the R-SIG-Finance mailing list