3

When I try to use an AR(3) model to predict / forecast future data I get a very poor forecast. I'm not too sure where I'm going wrong, or why the forecast then begins to decrease. More than grateful for any help or pointers. Thank you very much.

Here is my example:

import pandas as pd

df2 = pd.DataFrame({
     "Month" : [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
     "Sales Count": [10,15,24,30,33,45,67,70,75,88,92,95,98,105,115]
})

df2.index = df2.Month

df2 = df2.drop('Month',axis=1)

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(df2['Sales Count'],order=(3,0,0))
model = model.fit()

pred = model.predict(1,27)

These are my predicted values:

  • 1: 10.924977
  • 2 : 19.647766
  • 3 : 31.068473
  • 4 : 35.592394
  • 5 : 36.422376
  • 6 : 52.956438
  • 7 : 81.115237
  • 8 : 74.101817
  • 9 : 77.985398
  • 10 : 95.468273
  • 11 : 95.013056
  • 12 : 96.333352
  • 13 : 99.131086
  • 14 : 108.245458
  • 15 : 120.136458
  • 16 : 122.627635
  • 17 : 122.961509
  • 18 : 121.735104
  • 19 : 119.397032
  • 20 : 116.308360
  • 21 : 112.751786
  • 22 : 108.946149
  • 23 : 105.057805
  • 24 : 101.210451
  • 25 : 97.493384
  • 26 : 93.968447
  • 27 : 90.675809

Forecast Example Plot:

enter image description here

Rodalm
  • 5,169
  • 5
  • 21

1 Answers1

0

I would comment, but can't yet. Few clarifications are needed.

Why are you using an Auto-regressive modal for a prediction modal that's fit for linear regression? Predicting using AR processes introduces instability, and the higher the order the more difficult it becomes to keep the predictions stable since each coefficient corresponding to x[t-1], x[t-2], x[t-3] becomes harder to estimate.

Ritwick Jha
  • 340
  • 2
  • 10