Arima.sim issues in R

时间:2015-04-29 00:26:59

标签: r math statistics time-series forecasting

I am working on making a prediction in R using time-series models. I used the auto.arima function to find a model for my dataset (which is a ts object). fit<-auto.arima(data) I can then plot the results of the prediction for the 20 following dates using the forecast function:

plot(forecast(fit,h=20))

However I would like to add external variables and I cannot do it using forecast because it is kind of a black box to me as I am new to R. So I tried to mimic it by using the arima.sim function and a problem arose: HOW TO INITIALIZE THIS FUNCTION ? I got the model by setting model=as.list(coef(fit)) but the other parameters are still obscure to me. I went through hundreds of page including in stackoverflow but nobody seems to really know what is going on. How is it calculated ? Like why does n.start (the burn-in period) must have ma+ar length and not only a max(ar,ma) length ? What is exactly start.innov? I thought I understood when there is only an AR part but I cannot reproduce the results with an AR+MA filter. My understanding as for the AR is concerned is that start.innov represent the errors between a filtered zero-signal and the true signal, is it true ? Like if you want to have an ar of order 2 with initial conditions (a1,a2) you need to set

start.innov[1]=a1-ar1*0-ar2*0=a1 

start.innov[2]=a2-ar1*start.innov[1]

and innov to rep(0,20) but what to do when facing an arima function how do you set the innov to get exactly the same curbs as forecast does ? thanks for your help !!!

1 个答案:

答案 0 :(得分:1)

您似乎在建模和模拟之间感到困惑。你对auto.arima()也有误。

auto.arima() 通过xreg参数允许外生变量。阅读帮助文件。您可以使用forecast.Arima()包含未来期间的外生变量。再次,阅读帮助文件。

根本不清楚为什么你在这里引用arima.sim()。它用于模拟ARIMA流程,而不是用于建模或预测。