0

我尝试使用 ARIMA 来预测时间序列。

ts <- c(283.678,278.158,273.345,269.773,265.863,265.673,262.977,272.557,267.628,270.106,276.346,292.736,310.649,320.550,332.954,350.313,361.524,367.406,369.442,372.043,365.030,375.210,371.006,364.991,359.975,365.849,373.687,368.167,368.281,366.982,365.752,366.844,356.526,356.667,354.937,352.461,353.742,357.139,362.981,384.613,405.519,400.974,388.696,374.536,348.781,324.664,307.051,297.943)
ar <- arima(ts)
ps <- predict(ar, 48)
plot(c(ts, ps$pred), type="l")

为什么这段代码预测的是纯线而不是一些类似的曲线?

在此处输入图像描述

4

1 回答 1

0

因为您忘记在 中添加变量orderarima()因此拟合了一个ARIMA(0,0,0)模型,这只是一个常数截距项。

如果要自动拟合适当顺序的 ARIMA 模型(由 AIC、AICc 或 BIC 选择),可以auto.arima()forecast包中使用:

library(forecast)
ar <- auto.arima(ts)
ps <- predict(ar, 10)
ps
# $pred
# Time Series:
# Start = 49 
# End = 58 
# Frequency = 1 
# [1] 291.7978 287.6517 284.8543 282.9668 281.6934 280.8342 280.2545 279.8634 279.5995 279.4214
于 2017-08-03T11:22:37.437 回答