简体   繁体   English

Auto-arima在R-package预测中的奇怪行为

[英]Strange behavior of auto.arima in R-package forecast

I am trying to use the R-package forecast to fit arima models (with the function Arima) and automatically select an appropriate model (with the function auto.arima). 我正在尝试使用R-package预测来拟合arima模型(使用Arima函数)并自动选择合适的模型(使用函数auto.arima)。 I first estimated two possible models with the function Arima: 我首先估计了两种可能具有Arima功能的模型:

tt.1 <- Arima(x, order=c(1,0,1), seasonal=list(order=c(0,1,1)), 
              include.drift=F)
tt.2 <- Arima(x, order=c(1,0,1), seasonal=list(order=c(0,1,0)),
              include.drift=F)

Then, I used the function auto.arima to automatically select an appropriate model for the same data. 然后,我使用auto.arima函数自动为相同的数据选择合适的模型。 I fixed d=0 and D=1 just as in the two models above. 我修正了d = 0和D = 1,就像上面两个模型一样。 Furthermore, I set the maximum to 1 for all other parameters, did not use approximation of the selection criterion and did not use stepwise selection (note that the settings I use here are only for demonstration of the strange behavior, not what I really intend to use). 此外,我为所有其他参数设置最大值为1,没有使用选择标准的近似值并且没有使用逐步选择(注意我在这里使用的设置仅用于演示奇怪的行为,而不是我真正想要的采用)。 I used BIC as criterion for selection the model. 我使用BIC作为选择模型的标准。 Here is the function call: 这是函数调用:

tt.auto <- auto.arima(x, ic="bic", approximation=F, seasonal=T, stepwise=F, 
                  max.p=1, max.q=1, max.P=1, max.Q=1, d=0, D=1, start.p=1, 
                  start.q=1, start.P=1, start.Q=1, trace=T, 
                  allowdrift=F)

Now, I would have expected that auto.arima selects the model with the lower BIC from the two models above or a model not estimated above by Arima. 现在,我原本预计auto.arima会从上面两个模型中选择具有较低BIC的模型,或者选择Arima上面未估计的模型。 Furthermore, I would have expected that the output generated by auto.arima when trace=T is exactly the same as the BIC calculated by Arima for the two models above. 此外,我原本期望当trace = T时auto.arima生成的输出与Arima针对上述两个模型计算的BIC完全相同。 This is indeed true for the second model but not for the first one. 对于第二个模型确实如此,但对于第一个模型则不然。 For the first model, the BIC calculated by Arima is 10405.81 but the screen output of auto.arima for the model (1,0,1)(0,1,1) is Inf. 对于第一个模型,由Arima计算的BIC是10405.81,但模型(1,0,1)(0,1,1)的auto.arima的屏幕输出是Inf。 Consequently, the second model is selected by auto.arima although the first model has a lower BIC when comparing the two models estimated by Arima. 因此,第二个模型由auto.arima选择,尽管第一个模型在比较Arima估计的两个模型时具有较低的BIC。 Does anyone have an idea why the BIC calculated by Arima does not correspond to the BIC calculated by auto.arima in case of the first model? 有没有人知道为什么Arima计算的BIC与第一个模型的auto.arima计算的BIC不对应?

Here is the screen output of auto.arima: 这是auto.arima的屏幕输出:

 ARIMA(0,0,0)(0,1,0)[96]                    : 11744.63
 ARIMA(0,0,0)(0,1,1)[96]                    : Inf
 ARIMA(0,0,0)(1,1,0)[96]                    : Inf
 ARIMA(0,0,0)(1,1,1)[96]                    : Inf
 ARIMA(0,0,1)(0,1,0)[96]                    : 11404.67
 ARIMA(0,0,1)(0,1,1)[96]                    : Inf
 ARIMA(0,0,1)(1,1,0)[96]                    : Inf
 ARIMA(0,0,1)(1,1,1)[96]                    : Inf
 ARIMA(1,0,0)(0,1,0)[96]                    : 11120.72
 ARIMA(1,0,0)(0,1,1)[96]                    : Inf
 ARIMA(1,0,0)(1,1,0)[96]                    : Inf
 ARIMA(1,0,0)(1,1,1)[96]                    : Inf
 ARIMA(1,0,1)(0,1,0)[96]                    : 10984.75
 ARIMA(1,0,1)(0,1,1)[96]                    : Inf
 ARIMA(1,0,1)(1,1,0)[96]                    : Inf
 ARIMA(1,0,1)(1,1,1)[96]                    : Inf

And here are summaries of the models calculated by Arima: 以下是Arima计算的模型摘要:

> summary(tt.1)
Series: x 
ARIMA(1,0,1)(0,1,1)[96]                    

Coefficients:
         ar1      ma1     sma1
      0.9273  -0.5620  -1.0000
s.e.  0.0146   0.0309   0.0349

sigma^2 estimated as 867.7:  log likelihood=-5188.98
AIC=10385.96   AICc=10386   BIC=10405.81

Training set error measures:
                  ME     RMSE      MAE       MPE     MAPE      MASE        ACF1
Training set 0.205128 28.16286 11.14871 -7.171098 18.42883 0.3612059 -0.03466711
> summary(tt.2)
Series: x 
ARIMA(1,0,1)(0,1,0)[96]                    

Coefficients:
         ar1      ma1
      0.9148  -0.4967
s.e.  0.0155   0.0320

sigma^2 estimated as 1892:  log likelihood=-5481.93
AIC=10969.86   AICc=10969.89   BIC=10984.75

Training set error measures:
                ME     RMSE      MAE       MPE     MAPE    MASE        ACF1
Training set 0.1942746 41.61086 15.38138 -8.836059 24.55919 0.49834 -0.02253845

Note: I am not allowed to make the data available. 注意:我不允许提供数据。 But I would be happy to provide more output or run modified calls of the functions if necessary. 但我很乐意在必要时提供更多输出或运行已修改的函数调用。

EDIT: I now looked at the source code of auto.arima and found out that the behavior is caused by a check on the roots which sets the information criterion used for selecting a model to Inf if the model fails the check. 编辑:我现在查看auto.arima的源代​​码,发现行为是由根检查引起的,如果模型未通过检查,则设置用于选择模型的信息标准。 The paper cited in the help for auto.arima confirms that (Hyndman, RJ and Khandakar, Y. (2008) "Automatic time series forecasting: The forecast package for R", Journal of Statistical Software, 26(3), page 11). auto.arima帮助中引用的论文证实了(Hyndman,RJ和Khandakar,Y。(2008)“自动时间序列预测:R的预测包”,统计软件期刊,26(3),第11页) 。 Sorry for the question, I should have read the paper before asking a question here! 对不起,这个问题我应该在这里提问之前阅读这篇论文!

auto.arima tries to find the best model subject to some constraints, avoiding models with parameters that are close to the non-stationarity and non-invertibility boundaries. auto.arima试图找到受某些约束限制的最佳模型,避免使用接近非平稳性和非可逆性边界的参数的模型。

Your tt.1 model has a seasonal MA(1) parameter of -1 which lies on the non-invertibility boundary. 您的tt.1模型的季节性MA(1)参数为-1,它位于非可逆性边界上。 So you don't want to use that model as it will lead to numerical instabilities. 因此,您不希望使用该模型,因为它会导致数值不稳定。 The seasonal difference operator is confounded with the seasonal MA operator. 季节性差异运算符与季节性MA运算符混淆。

Internally, auto.arima gives an AIC/AICc/BIC value of Inf to any model that doesn't satisfy the constraints to avoid it being selected. 在内部, auto.arima为任何不满足约束的模型提供Inf的AIC / AICc / BIC值,以避免被选中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM