I'm using statsmodels to create an ARIMA(3,0,0) (so basically an AR(3)) model.

model = ARIMA(train_data['lnP'], order=(3,0,0))
modelfit = model.fit()

These are the coefficient results:

                 coef    std err          z      P>|z|      [0.025      0.975]
const       5.617e-06   3.22e-06      1.742      0.082   -7.03e-07    1.19e-05
ar.L1          0.1835      0.001    221.505      0.000       0.182       0.185
ar.L2         -0.0491      0.001    -36.368      0.000      -0.052      -0.046
ar.L3         -0.0123      0.002     -7.506      0.000      -0.016      -0.009
sigma2      4.163e-07   4.37e-10    951.914      0.000    4.15e-07    4.17e-07

I then calculate the rolling 1 step forward forecast for my test data:

forecasts = []
for index,row in test_data.iterrows():
    modelfit = modelfit.append([row['lnP']])

But when I plot the actual data with the rolling 1 step forecasts it seems as if they are off by a factor of 10. Is this purely due to the value of the coefficients of the model? For instance if there are 3 consecutive data points of 1, 1 and 1 the forecasted value for the next timestamp would be 1*0.1835 - 1*0.0491 - 1*0.0123 which is about 10 times less than the value of those 3 datapoints, correct? So if the sum of my weights is 0.12 I should expect all my forecasts to be about 1/12th of the actual value?

Here is the plot of actual vs forecasted values: Actual vs forecasted

Another question is: As you can see in the parameters table sigma2 is 4.163e-07. However if I calculate the variance of my calculated errors I get 3.504e-07, why the difference?

test_data['fcast'] = [i[0] for i in forecasts]
test_data['errors'] = (test_data['fcast'] - test_data['lnP'])
new_sigma2 = np.std(test_data['eth_errors'])**2
  • 1
    $\begingroup$ Predictions will always vary less than historical actuals, because your model tries to separate the forecastable variation from the noise, and the noise by definition is not forecastable. See links in stats.meta.stackexchange.com/q/5567/1352. Your specific ARIMA model will tend towards the intercept of 5.617e-06 in the long term. $\endgroup$ Commented Feb 9, 2023 at 7:49
  • $\begingroup$ Thank you, the link(s) you provided has been really helpful. One more question: If I apply an ARIMA-GARCH model, will it help to increase the variance of the forecast when there is larger volatility in the observations, or will the forecasted return be (approximately?) the same and it will only help with more accurate confidence intervals? Thanks $\endgroup$
    – Hiperfly
    Commented Feb 9, 2023 at 10:55
  • $\begingroup$ Unfortunately, I don't know enough about GARCH to give a useful answer to that, sorry... $\endgroup$ Commented Feb 9, 2023 at 11:02
  • $\begingroup$ I don't see where there's a problem. Doesn't GARCH explicitly suppose the error variances change over time? That implies it's almost meaningless to compute the standard deviation of all the residuals, which I'm guessing np.std is doing. All you will obtain is some sort of average standard deviation . $\endgroup$
    – whuber
    Commented Feb 9, 2023 at 16:02
  • $\begingroup$ The basic ARIMA-GARCH is separable. The mean estimate is consistent even if the GARCH effect is ignored, similar to OLS consistent parameter estimation under heteroscedasticity. Only the (conditional) variance is affected, and cov_params if that is not HC robust. $\endgroup$
    – Josef
    Commented Feb 10, 2023 at 20:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.