模拟季节性ARIMA模型的问题

模拟季节性ARIMA模型的问题

本文介绍了模拟季节性ARIMA模型的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下命令使用R中的预测包从季节性Arima模型生成模拟:

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

simulate(model_temp)

其中,model_temp是对我观察到的时间序列应用arima()函数的结果,顺便说一句,我将模型指定为ARIMA(2,1,2)(0,1,2 )[12]模型.

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)?

我还要补充一点,我知道我应用并导致model_temp拟合的模型不是生成系列的模型,但是,尽管如此,我仍然想从该模型生成模拟(或与此相关的任何其他模型).

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).

最后,是否可以仅通过指定ar,d,ma,sar,sd,sma和sigma参数,而无需首先创建正确ARIMA类型的对象,就可以从季节性ARIMA模型生成模拟?

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?

感谢您的帮助,

乔纳森

推荐答案

当您缺少值时,就会发生这种情况,如下例所示.

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

默认参数模拟有条件的未来值在数据上,如果缺少某些值则失败.如果需要不相关的样本,可以添加future=FALSE.

The default arguments simulate future values conditionalon 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

要从任意模型进行仿真,您可以尝试建立一个最小的Arima对象,只需所需的数据.

To simulate from an arbitrary model, you can try tobuild 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)

这篇关于模拟季节性ARIMA模型的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 05:25