Weird intercept (constant) from ARIMA Model of statsmodels.tsa

59 Views Asked by At

I am trying to fit a AR(2) with intercept model to a timeseries. However, the intercept calibrated really confuses me. The value is 14.0695 which is extremely huge. And also, in-sample 1 step ahead prediction is not consistent with the calibrated formula. For example, Xhat(2) = 18.82120161. X(0) = 19.75569344, X(1) = 18.71735649. If we apply the calibrated formula, which is Xhat(t) = 0.8813X(t-1) + 0.1153X(t-2) + 14.0695, Xhat(2) should have been 32.8429. So, neither the huge intercept value nor the one step in sample prediction makes sense to me. Please help me understand. Thanks in advance

Here is the code:

from statsmodels.tsa.arima.model import ARIMA

print(frcModel.flatten()[:10])
print(adfuller(frcModel.flatten()))
arimaModel = ARIMA(frcModel.reshape(-1, 1), order=(2,0,0), trend='c')
arimaModelFit = arimaModel.fit()
print(arimaModelFit.arparams)
print(arimaModelFit.summary())
print(arimaModelFit.predict()[:10])

And here is the output:

[19.75569153 18.71735656 18.25700184 18.81511352 18.87657195 18.36287296
 17.87219516 17.66853826 17.39121172 17.58532754]
(-2.8895818139077556, 0.04657297295805522, 3, 4146, {'1%': -3.4319282328371266, '5%': -2.8622373766412523, '10%': -2.567141219855403}, 293.622839039861)
[0.88128907 0.11529613]
                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      y   No. Observations:                 4150
Model:                 ARIMA(2, 0, 0)   Log Likelihood                -174.839
Date:                Wed, 07 Feb 2024   AIC                            357.677
Time:                        18:25:29   BIC                            383.001
Sample:                             0   HQIC                           366.637
                               - 4150                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         14.0695      1.071     13.139      0.000      11.971      16.168
ar.L1          0.8813      0.012     70.885      0.000       0.857       0.906
ar.L2          0.1153      0.012      9.276      0.000       0.091       0.140
sigma2         0.0636      0.001     72.962      0.000       0.062       0.065
===================================================================================
Ljung-Box (L1) (Q):                   0.01   Jarque-Bera (JB):              1939.37
Prob(Q):                              0.91   Prob(JB):                         0.00
Heteroskedasticity (H):               0.40   Skew:                            -0.20
Prob(H) (two-sided):                  0.00   Kurtosis:                         6.32
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
[14.06954533 19.73374402 18.82120122 18.29577963 18.73456024 18.853071
 18.40743961 17.91578312 17.67972927 17.41184357]
0

There are 0 best solutions below