Issues with simulating a seasonal ARIMA model

你说的曾经没有我的故事 提交于 2019-12-07 03:53:59

问题


I am trying to generate simulations from a seasonal arima model using the forecast package in R via the following command:

simulate(model_temp)

where model_temp is the result of applying the arima() function to my observed time series, and with which, incidentally, I specified the model to be an ARIMA(2,1,2)(0,1,2)[12] model.

However, when I attempt this, I get the following error:

Error in diffinv.vector(x, lag, differences, xi) :
  NA/NaN/Inf in foreign function call (arg 1) 

Can anybody please explain why this is the case (and how to avoid this problem)?

I should further add, that I know that the model that I applied and resulting in the fit of model_temp is not the model that generated the series, but nevertheless, I would still like to generate simulations from that model (or any other model for that matter).

Lastly, is it possible to generate simulations from a seasonal ARIMA model by just specifying the ar, d, ma, sar, sd, sma and sigma parameters and without having first created an object of the correct ARIMA type?

Thank you for any help,

Jonathan


回答1:


This happens when you have missing values, as in the following example.

library(forecast)
x <- WWWusage
x[10] <- NA
fit <- Arima(x,c(3,1,0), seasonal=list(order=c(0,1,1),period=12))
simulate(fit) # Fails

The default arguments simulate future values conditional on the data, and fails if some values are missing. If you want an unrelated sample, you can add future=FALSE.

simulate(fit, future=FALSE) # Does not fail

To simulate from an arbitrary model, you can try to build a minimal Arima object, with only the data needed.

m <- list(
  arma=c(3,0,0,1,12,1,1),
  model=list(
    phi=c(1.17, -0.71, 0.39),
    theta=c(0,0,0,0,0,0,0,0,0,0,0,-.79)
  ),
  sigma2=11,
  x=NA
)
simulate.Arima(m, nsim=30, future=FALSE)


来源:https://stackoverflow.com/questions/9561035/issues-with-simulating-a-seasonal-arima-model

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!