[R] Predict ARMA GARCH model with new data
Be Water
bwater at outlook.com
Fri Oct 28 16:00:02 CEST 2016
How to add newdata to be predicted in an ARMA GARCH model with the fGARCH package?
## R version 3.3.1 (2016-06-21)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows >= 8 x64 (build 9200)
library(fGarch)
## Data simulation
set.seed(345)
ar.sim <- arima.sim(model=list(ar=c(.9,-.2)), n=1000)
tail(ar.sim)
plot(ar.sim)
## Model fit
model = garchFit( ~ arma(1, 2) + garch(1, 1), Data=ar.sim)
print(model)
help(garchFit,package="fGarch")
##QUESTION 1: How to add newdata to be predicted?
newdata <- data.frame(x= -0.3)
newdata <- -0.3
predict(model, newdata = newdata, n.ahead=1)[1,1]
##QUESTION 2: If this is the correct way, why do I get the same result with different newdata?
predict(model, newdata= -1.035, n.ahead=1)
predict(model, newdata= 0.124, n.ahead=1)
help(predict, package="fGarch")
[[alternative HTML version deleted]]
More information about the R-help
mailing list