2016-06-18 3 views
0
m7 = arima(lill,order=c(0,0,1), 
      seasonal=list(order=c(1,0,0),period=22), 
      xreg=data.frame(lpGDP)) 

preds = predict(m7,n.ahead = 1, newxreg = 1) 

lillオブジェクトには329件の観測結果があります。 330観測の代わりに、最後の観測328をどのように予測できますか?ありがとうございました。arima:ARIMAの時系列はどのように取得できますか?

答えて

1

観測データの予測にはpredictを呼び出す必要はありません。次のようにすることができます:

fitted_values <- lill - m7$residuals 

これは適合したARIMAモデルです。第三百二十八値を検査するには、

fitted_values[328] 

を行う私はあなたのデータを持っていないので、私はRの組込みデータを使っおもちゃのデモンストレーションとして​​を設定します。

fit <- arima(LakeHuron, order = c(2,0,0), xreg = time(LakeHuron) - 1920) 
fitted_values <- LakeHuron - fit$residuals 
ts.plot(LakeHuron) ## observed time series (black) 
lines(fitted_values, col = 2) ## fitted time series (red) 

toy