Python auto_arima identifies model with intercept as best - how to fit?

Viewed 16

I have a very simple question: I am running the auto_arima function on my time series (506 observations). Here is the code and output:

from statsmodels.tsa.arima_model import ARIMA
import pmdarima as pm

model = pm.auto_arima(data_arima, start_p=1, start_q=1, d=None, test='adf', max_p=7, max_q=6, m=12, D=None, seasonal=False, trace=True, suppress_warnings=True, stepwise=True)
print(model.summary())



Output:

Performing stepwise search to minimize aic
 ARIMA(1,0,1)(0,0,0)[0]             : AIC=11470.692, Time=0.15 sec
 ARIMA(0,0,0)(0,0,0)[0]             : AIC=14121.836, Time=0.02 sec
 ARIMA(1,0,0)(0,0,0)[0]             : AIC=inf, Time=0.07 sec
 ARIMA(0,0,1)(0,0,0)[0]             : AIC=13755.546, Time=0.09 sec
 ARIMA(2,0,1)(0,0,0)[0]             : AIC=11478.477, Time=0.41 sec
 ARIMA(1,0,2)(0,0,0)[0]             : AIC=11385.072, Time=1.19 sec
 ARIMA(0,0,2)(0,0,0)[0]             : AIC=13672.382, Time=0.18 sec
 ARIMA(2,0,2)(0,0,0)[0]             : AIC=11348.040, Time=0.72 sec
 ARIMA(3,0,2)(0,0,0)[0]             : AIC=11516.250, Time=0.77 sec
 ARIMA(2,0,3)(0,0,0)[0]             : AIC=11325.077, Time=0.64 sec
 ARIMA(1,0,3)(0,0,0)[0]             : AIC=11344.213, Time=0.50 sec
 ARIMA(3,0,3)(0,0,0)[0]             : AIC=11181.431, Time=1.42 sec
 ARIMA(4,0,3)(0,0,0)[0]             : AIC=11413.243, Time=1.34 sec
 ARIMA(3,0,4)(0,0,0)[0]             : AIC=11090.038, Time=2.17 sec
 ARIMA(2,0,4)(0,0,0)[0]             : AIC=11284.167, Time=0.33 sec
 ARIMA(4,0,4)(0,0,0)[0]             : AIC=11122.202, Time=2.04 sec
 ARIMA(3,0,5)(0,0,0)[0]             : AIC=11222.329, Time=1.78 sec
 ARIMA(2,0,5)(0,0,0)[0]             : AIC=11189.030, Time=1.48 sec
 ARIMA(4,0,5)(0,0,0)[0]             : AIC=11243.559, Time=2.22 sec
 ARIMA(3,0,4)(0,0,0)[0] intercept   : AIC=11085.794, Time=1.93 sec
 ARIMA(2,0,4)(0,0,0)[0] intercept   : AIC=11332.117, Time=0.57 sec
 ARIMA(3,0,3)(0,0,0)[0] intercept   : AIC=11093.710, Time=1.89 sec
 ARIMA(4,0,4)(0,0,0)[0] intercept   : AIC=inf, Time=2.48 sec
 ARIMA(3,0,5)(0,0,0)[0] intercept   : AIC=11274.547, Time=1.41 sec
 ARIMA(2,0,3)(0,0,0)[0] intercept   : AIC=11394.942, Time=0.47 sec
 ARIMA(2,0,5)(0,0,0)[0] intercept   : AIC=11266.073, Time=1.89 sec
 ARIMA(4,0,3)(0,0,0)[0] intercept   : AIC=inf, Time=1.92 sec
 ARIMA(4,0,5)(0,0,0)[0] intercept   : AIC=11074.450, Time=2.61 sec
 ARIMA(5,0,5)(0,0,0)[0] intercept   : AIC=11009.910, Time=2.77 sec
 ARIMA(5,0,4)(0,0,0)[0] intercept   : AIC=11020.582, Time=2.52 sec
 ARIMA(6,0,5)(0,0,0)[0] intercept   : AIC=inf, Time=2.83 sec
 ARIMA(5,0,6)(0,0,0)[0] intercept   : AIC=inf, Time=2.99 sec
 ARIMA(4,0,6)(0,0,0)[0] intercept   : AIC=inf, Time=2.63 sec
 ARIMA(6,0,4)(0,0,0)[0] intercept   : AIC=11190.038, Time=2.86 sec
 ARIMA(6,0,6)(0,0,0)[0] intercept   : AIC=inf, Time=3.24 sec
 ARIMA(5,0,5)(0,0,0)[0]             : AIC=11011.535, Time=2.30 sec

Best model:  ARIMA(5,0,5)(0,0,0)[0] intercept
Total fit time: 54.876 seconds
                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      y   No. Observations:                  506
Model:               SARIMAX(5, 0, 5)   Log Likelihood               -5492.955
Date:                Wed, 21 Sep 2022   AIC                          11009.910
Time:                        10:00:54   BIC                          11060.629
Sample:                             0   HQIC                         11029.802
                                - 506                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
intercept   9011.4231   1.09e+04      0.829      0.407   -1.23e+04    3.03e+04
ar.L1          0.2815      0.031      9.165      0.000       0.221       0.342
ar.L2          0.5408      0.030     17.869      0.000       0.481       0.600
ar.L3         -0.6739      0.024    -27.716      0.000      -0.722      -0.626
ar.L4         -0.0355      0.035     -1.028      0.304      -0.103       0.032
ar.L5          0.8586      0.027     31.279      0.000       0.805       0.912
ma.L1          0.7898      0.047     16.800      0.000       0.698       0.882
ma.L2          0.0999      0.049      2.043      0.041       0.004       0.196
ma.L3          0.8536      0.031     27.878      0.000       0.794       0.914
ma.L4          0.7885      0.049     16.002      0.000       0.692       0.885
ma.L5         -0.1333      0.041     -3.234      0.001      -0.214      -0.053
sigma2      1.417e+08      0.461   3.07e+08      0.000    1.42e+08    1.42e+08
===================================================================================
Ljung-Box (L1) (Q):                   0.87   Jarque-Bera (JB):                 4.67
Prob(Q):                              0.35   Prob(JB):                         0.10
Heteroskedasticity (H):               4.42   Skew:                            -0.02
Prob(H) (two-sided):                  0.00   Kurtosis:                         3.47
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
[2] Covariance matrix is singular or near-singular, with condition number  8e+28. Standard errors may be unstable.

Now, I want to fit the model that is identified to be the best (ARIMA(5,0,5)(0,0,0)[0] intercept) to my data, but when I run this code:

arima = ARIMA(data_arima, order=(5,0,5)).fit()

the model summary shows a different AIC (11078.323), so I am assuming it is not the same model. Does this have to do with the "intercept" specification in the model summary above? Because in the auto_arima output there are two ARIMA(5,0,5) models: One with the intercept term and one without. But how do I specify that I want the one with the intercept in my model fit?

Any help greatly appreciated!

0 Answers
Related