I have written the below code to forecast data using ARIMA of stats models,but my results are not matching with the actual data and the predicted values become almost constant after first few predictions giving a straight horizontal line on graph.
And if the prediction is for 2nd differencing order because i have used d=2,how can i get the prediction for original data for the same model.
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)
Actual data
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
predicted value
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
A little hint. You should include a dummy intervention variable at period 11,12, 21. There is no need to double difference this model. Just an intercept and 3 intervention variables would work. Y(T) = 332.20
+[X1(T)][(- 196.87 )] :PULSE 12 +[X2(T)][(- 153.53 )] :PULSE 21 +[X3(T)][(- 109.68 )] :PULSE 11 + + [A(T)]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.