[R-SIG-Finance] How to add new data to be predicted with fGarch?
Be Water
bwater at outlook.com
Tue Nov 1 10:57:42 CET 2016
## 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)
##QUESTION: How to add new data to be predicted?
help('predict-methods', pac=fGarch) ## I cannot find any example
newdata <- data.frame(x= -0.3)
newdata <- -0.3
predict(model, newdata = newdata, n.ahead=1)
Thanks
More information about the R-SIG-Finance
mailing list