我已经编写了以下代码来使用统计模型的ARIMA来预测数据,但是我的结果与实际数据不匹配,并且在最初几次预测在图上给出一条直线水平线后,预测值几乎不变。
如果预测是针对第二个差分顺序,因为我使用了d = 2,我如何得到同一模型的原始数据的预测。
arima_mod = sm.tsa.ARIMA(df, (1,2,0)).fit()
print(arima_mod.params)
print(arima_mod.summary())
predict_workshop = arima_mod.predict('2011-04-01', '2011-05-30',dynamic=True)
print(predict_workshop)
实际数据
2011-04-01 356.839
2011-04-02 363.524
2011-04-03 332.864
2011-04-04 336.228
2011-04-05 264.749
2011-04-06 321.212
2011-04-07 384.382
2011-04-08 273.250
2011-04-09 307.062
2011-04-10 326.247
2011-04-11 222.521
2011-04-12 135.326
2011-04-13 374.953
2011-04-14 329.583
2011-04-15 358.853
2011-04-16 343.169
2011-04-17 312.086
2011-04-18 339.302
2011-04-19 300.534
2011-04-20 367.166
2011-04-21 178.670
2011-04-22 320.823
2011-04-23 349.995
2011-04-24 323.120
2011-04-25 331.665
2011-04-26 352.993
2011-04-27 359.253
2011-04-28 308.281
2011-04-29 329.357
2011-04-30 301.873
预测值
2011-04-01 -50.693560
2011-04-02 30.715553
2011-04-03 -19.081318
2011-04-04 11.378766
2011-04-05 -7.253263
2011-04-06 4.143701
2011-04-07 -2.827670
2011-04-08 1.436625
2011-04-09 -1.171787
2011-04-10 0.423744
2011-04-11 -0.552221
2011-04-12 0.044764
2011-04-13 -0.320404
2011-04-14 -0.097036
2011-04-15 -0.233667
2011-04-16 -0.150092
2011-04-17 -0.201214
2011-04-18 -0.169943
2011-04-19 -0.189071
2011-04-20 -0.177371
2011-04-21 -0.184528
2011-04-22 -0.180150
2011-04-23 -0.182828
2011-04-24 -0.181190
2011-04-25 -0.182192
2011-04-26 -0.181579
2011-04-27 -0.181954
2011-04-28 -0.181724
2011-04-29 -0.181865
2011-04-30 -0.181779
答案 0 :(得分:0)
一点点暗示。您应该在11,12,21期间包含一个虚拟干预变量。此模型不需要加倍差异。只需一个拦截和3个干预变量就可以了。 Y(T)= 332.20
+ [X1(T)] [( - 196.87)]:PULSE 12
+ [X2(T)] [( - 153.53)]:PULSE 21
+ [X3(T)] [( - 109.68)]:PULSE 11
+ + [A(T)]