首页 > 解决方案 > Python statsmodel ARIMA 预测版本之间的差异

问题描述

我有一组训练的乘客:

train['Passengers']

Month
1949-01-01    112
1949-02-01    118
1949-03-01    132
1949-04-01    129
1949-05-01    121
...
1959-08-01    559
1959-09-01    463
1959-10-01    407
1959-11-01    362
1959-12-01    405
Freq: MS, Name: Passengers, Length: 132, dtype: int64

现在使用 statsmodel 我想实现 ARIMA(8,1,1)。

但是,statsmodels.tsa.arima.model.ARIMA 似乎预测的值与已弃用的版本 statsmodels.tsa.arima_model.ARIMA 不同。

statsmodels.tsa.arima.model.ARIMA:

from statsmodels.tsa.arima.model import ARIMA
arima = ARIMA(train['Passengers'], order=(8,1,1))
arima_result = arima.fit()
arima_result.predict(start=train.index[1], end=train.index[-1])

Month
1949-02-01    112.034073
1949-03-01    119.751782
1949-04-01    135.651835
1949-05-01    124.246608
1949-06-01    116.279857
...   
1959-08-01    542.722017
1959-09-01    481.743123
1959-10-01    413.868022
1959-11-01    354.078873
1959-12-01    355.815461
Freq: MS, Name: predicted_mean, Length: 131, dtype: float64

statsmodels.tsa.arima_model.ARIMA:

from statsmodels.tsa.arima_model import ARIMA
arima = ARIMA(train['Passengers'], order=(8,1,1))
arima_result = arima.fit()
arima_result.predict(start=train.index[1], end=train.index[-1])

Month
1949-02-01     2.532206
1949-03-01     3.585345
1949-04-01     6.018756
1949-05-01    -2.077600
1949-06-01    -1.577707
...   
1959-08-01   -10.896945
1959-09-01   -86.790586
1959-10-01   -49.189211
1959-11-01   -50.916200
1959-12-01    -3.487137
Freq: MS, Length: 131, dtype: float64

这怎么可能?以及如何使用新版本恢复对已弃用版本的预测?

标签: pythonversionpredictionstatsmodelsarima

解决方案


推荐阅读