i use rollapply
in order to create 1-step ahead forecasts of a GARCH(1,1) model (garchFit
). An example is provided below:
require(fGarch)
require(zoo)
data(EuStockMarkets)
dax <- diff(log(EuStockMarkets))[,"DAX"]
gfit <- function(df)
{
series <- df
capture.output(gf <- garchFit(formula=~arma(0,0) + garch(1,1), data=series), file='NUL')
g <- predict(gf, n.ahead=1)[,2]
attributes(g) <- NULL
return(g)
}
rolling <- rollapply(dax, width=250, FUN=gfit)
However, this takes a relatively long time. So my question is: Is there a method of speeding this up?