【问题标题】:Specify seasonal ARIMA指定季节性 ARIMA
【发布时间】:2018-08-24 06:58:28
【问题描述】:

我遇到了一些预测::Arima 语法问题。如果我知道季节性 ARIMA 在统计上是可以的,因为它是 auto.arima 的结果,我该如何修复以下 Arima 函数以与 auto.arima 结果具有相同的顺序:

library(forecast)

set.seed(1)
y <- sin((1:40)) * 10 + 20 + rnorm(40, 0, 2)
my_ts <- ts(y, start = c(2000, 1), freq = 12)

fit_auto <- auto.arima(my_ts, max.order = 2)
plot(forecast(fit_auto, h = 24))
# Arima(0,0,1)(1,0,0) with non-zero mean

fit_arima <- Arima(my_ts,
                   order = c(0, 0, 1),
                   seasonal = list(c(1, 0, 0)))
#Error in if ((order[2] + seasonal$order[2]) > 1 & include.drift) { : 
#  argument is of length zero

谢谢和亲切的问候

【问题讨论】:

    标签: r arima


    【解决方案1】:

    seasonal 的参数必须是一个给出季节性顺序的数字向量,或者是一个包含两个命名元素的列表:order,给出季节性顺序的数字向量,period,一个给出季节性的整数周期性。

    您提供了一个仅包含季节性订单的列表,因此 Arima 抱怨它找不到 period 值。如果你给出一个数字向量,period 将默认为frequency(my_ts),就像函数文档中所说的那样。虽然仅以数字或列表的形式给出顺序应该具有相同的结果,但事实并非如此。只是这个功能的一个怪癖。

    重写你的调用:

    fit_arima <- Arima(my_ts,
                       order = c(0, 0, 1),
                       seasonal = c(1, 0, 0)) # vector, not a list
    

    【讨论】:

      猜你喜欢
      • 2023-03-24
      • 2016-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 2016-09-28
      • 1970-01-01
      • 2020-03-02
      相关资源
      最近更新 更多