I'm using rugarch package to estimate and forecast my time series. First, I estimate an ARMA model:
y <- readRDS("y.rds")
y.test <- readRDS("y-test.rds")
m1.mean.model <- auto.arima(y, allowmean=F )
ar.comp <- arimaorder(m1.mean.model)[1]
ma.comp <- arimaorder(m1.mean.model)[3]
But usually the error terms show typical characteristics of a GARCH process. Subsequently, I fit an ARMA-GARCH(1,1) process, and preform one-step ahead forecasting on test data:
library(rugarch)
model.garch = ugarchspec(mean.model=list(armaOrder=c(ar.comp,ma.comp)),
variance.model=list(garchOrder=c(1,1)),
distribution.model = "std")
model.garch.fit = ugarchfit(data=c(y,y.test), spec=model.garch, out.sample = length(y.test), solver = 'hybrid' )
modelfor=ugarchforecast(model.garch.fit, data = NULL, n.ahead = 1, n.roll
= length(y.test), out.sample = length(y.test))
results1 <- modelfor@forecast$seriesFor[1,] + modelfor@forecast$sigmaFor[1,]
results2 <- modelfor@forecast$seriesFor[1,] - modelfor@forecast$sigmaFor[1,]
ylim <- c(min(y.test), max(y.test))
plot.ts(y.test , col="blue", ylim=ylim)
par(new=TRUE)
modelfor@forecast$seriesFor[1,] %>% plot.ts(ylim=ylim)
par(new=TRUE)
plot.ts(results1, col="red", ylim=ylim)
par(new=TRUE)
plot.ts(results2, col="red", ylim=ylim)
This is where I get confused. Looking at the predictions for the mean (modelfor@forecast$seriesFor
, black), they barely move from zero. However, if I add sigma
to it, it comes very close. In fact, forecasts of sigma
(second plot) show that it is capturing the changing variance. My question is, given that we know forecasts of the variance enter in the equation for mean prediction (for example p.204 of this book), why is it that my forecasts are so poor?
data: y-test.rds, y.rds