使用 ARIMA 模型进行预测
上一个练习中的自动方法为 austa 数据选择了带漂移项的 ARIMA(0,1,1) 模型,即:
\(y_t = c + y_{t-1} + \theta e_{t-1} + e_t.\)
现在,您将尝试该数据的其他多种 ARIMA 模型,看看对预测会带来怎样的影响。
Arima() 函数可用于指定特定的 ARIMA 模型。它的第一个参数 order 是一个向量,用于给出 $p$、\(d\) 和 \(q\) 的取值。第二个参数 include.constant 是布尔值,用于控制是否包含常数项 $c$(即 drift)。下面是一个通过管道绘制来自带漂移项的 ARIMA(2,1,2) 模型对 usnetelec 的预测的示例:
> usnetelec %>%
Arima(order = c(2,1,2), include.constant = TRUE) %>%
forecast() %>%
autoplot()
在这些示例中,请留意不同模型如何影响预测值与预测区间。austa 数据已在您的工作区中就绪,可直接使用。
本练习是课程的一部分
R 中的预测
练习说明
- 绘制来自不带漂移项的 ARIMA(0,1,1) 模型的预测。
- 绘制来自带漂移项的 ARIMA(2,1,3) 模型的预测。
- 绘制来自带常数项的 ARIMA(0,0,1) 模型的预测。
- 绘制来自不带常数项的 ARIMA(0,2,1) 模型的预测。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Plot forecasts from an ARIMA(0,1,1) model with no drift
austa %>% Arima(order = c(___, ___, ___), include.constant = ___) %>% ___ %>% ___
# Plot forecasts from an ARIMA(2,1,3) model with drift
austa %>% Arima(___, ___) %>% ___ %>% ___
# Plot forecasts from an ARIMA(0,0,1) model with a constant
austa %>% Arima(___, ___) %>% ___ %>% ___
# Plot forecasts from an ARIMA(0,2,1) model with no constant
austa %>% Arima(___, ___) %>% ___ %>% ___