[R-SIG-Finance] Window size in ugarchroll of rugarch package?
alexios ghalanos
alexios at 4dscape.com
Sat Jun 15 09:15:05 CEST 2013
The shortest way to understand how it works and feel confident that it
DOES what it is supposed to do, is to look at the ugarchroll function,
which as stated on numerous occasions is a wrapper for ugarchfit and
ugarchforecast. The code can be obtained by looking in the R directory
(file: 'rugarch-rolling.R') of the package source or by typing:
rugarch:::.rollfdensity
Regards,
Alexios
On 12/06/2013 16:31, Alexandra Bridges wrote:
> Hi,
> I did already a post to the list about another problem and you helped
> me out, but this time, I have problems with understanding the
> ugarchroll command:
>
> I want to use a reestimation every day, which uses 400 observations.
> The first window should use the first 400 observations. Therefore, I
> set n.start to 400 and window.size to 400, my code (the rolling
> estimation takes about 2.1 minutes):
>
> library(rugarch)
> data(sp500ret)
>
> datamodified<- subset(sp500ret, row(sp500ret) < 1001)
>
> myspecification<-ugarchspec(variance.model = list(model = "sGARCH",
> garchOrder = c(1, 1)),
> mean.model = list(armaOrder = c(0, 0), include.mean = FALSE),
> distribution.model = "norm")
>
> rolling = ugarchroll(myspecification, datamodified, n.start=400,
> refit.every = 1, refit.window = 'moving', window.size = 400,
> calculate.VaR = FALSE, keep.coef = TRUE)
>
> show(rolling)
>
> So the first forecast is for the 401th day, the 1988-10-06.
>
> I now want to verify the results by reestimation one certain window, I
> have choosen the third window:
>
> coef(rolling)[[3]]
>
> This window shows, that it uses observations until 1988-10-07 (the
> date is the "ending date of each estimation window."). The estimates
> output of this window is:
>
> Estimate Std. Error t value Pr(>|t|)
> omega 0.0000148153 1.133298e-05 1.307272 1.911203e-01
> alpha1 0.2977622797 1.801401e-01 1.652948 9.834147e-02
> beta1 0.6972828253 1.328726e-01 5.247754 1.539647e-07
>
> I now want to reproduce them with one single ugarchfit-command:
>
> thirdwindow<-datamodified[2:402,1]
> fitverify<-ugarchfit(spec=myspecification,data=thirdwindow)
> coef(fitverify)
>
> This gives the same estimates. BUT this uses 401 observations?
> length(2:402) is 401 and not just 400? So why is not 3:402 correct? If
> I do it with 3:402 it leads to different estimates?
>
> Thanks a lot for your help!
>
> --
> Alexa Bridges
>
> _______________________________________________
> 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