[R-SIG-Finance] rolling forecasts with rugarch

alexios alexios at 4dscape.com
Thu Aug 13 21:02:16 CEST 2015


You email has arrived very badly formatted making it difficult to 
read...in any case, I suggest you look at the underlying function in the 
source (rugarch-rolling.R) to see how the rolling estimation/forecasting 
is performed, which should allow you to reproduce the results exactly 
with ugarchforecast (ugarchroll is after all just a wrapper around this).

You should also search this mailing list's archives for similar/related 
questions.

Alexios

On 12/08/2015 15:27, Pippens Pips wrote:
> Hi,This is my first time using this so sorry in advance if my post is not clear. I am trying to use the past 500 days to create a rolling forecast 1 day ahead. So for the 501th day I would use 1-500 and for the 502nd day I would use 2-501. I am using the ugarchroll command for the next 20 days. I understand that the code should be this:
> library(quantmod)library(rugarch)library(PerformanceAnalytics)getSymbols("SPY")spyRets=na.omit(Return.calculate(Cl(SPY),method=c('log'))) #log returnsspec=ugarchspec(mean.model=list(armaOrder=c(3,3))) #arma(3,3) and garch(1,1)GARCH=ugarchfit(spec,head(spyRets,500),solver="hybrid") #run regressionspyRetssub=spyRets[1:520,]roll=ugarchroll(spec,data=spyRetssub,n.start=500,refit.every=1,window.size=500,refit.window=c('moving'),solver='hybrid')rollingforecasts=xts(roll at forecast$density$Mu,order.by=index(spyRets[501:520,])) #my forecasts for next 20 days with walk forward
> I now check that by manually doing the same forecasts except now I will use the ugarchforecast function and then just change the data to the subset that I want.
> setfixed(spec)=as.list(coef(GARCH))forecast501=ugarchforecast(spec,data=spyRets[1:500],n.ahead=1) #give me one step ahead forecastfitted(forecast501) #t+1 fitted value. This matchesforecast502=ugarchforecast(spec,data=spyRets[2:501],n.ahead=1) #give me one step ahead forecastfitted(forecast502) #t+2 fitted value. This does not match with rolling forecastforecast503=ugarchforecast(spec,data=spyRets[3:502],n.ahead=1) #give me one step ahead forecastfitted(forecast503) #t+3 fitted value. This does not match with rolling forecast
> The issue is that the 1st forecast matches, however after that the forecasts break down. Is there something that I am doing wrong in my original rolling forecast code that gets the first t+1 day correct but not the rest?
> Thanks in advancePippens
> 	[[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