为什么趋势/漂移项没有出现在我的statsmodel-ARIMA结果中?

时间:2020-05-22 09:41:23

标签: python pandas time-series statsmodels arima

我在某些时间序列上使用statsmodel-特别是手动生成ADF结果以更好地了解过程。但是,我不确定如果手动将exog变量包括在内,为什么趋势/漂移项没有出现在ARIMA(1,1,0)结果中,而是出现在ARIMA(0,0,0)结果中。下面的两个模型应该相等。

使用ARIMA(1,1,0)

res_arima = sm.tsa.arima.ARIMA(df.log_biz_machine_investment.loc[start:end], order=(1,1,0), trend='ct', freq='QS', trend_offset=df.index.get_loc(start)+1)
print(res_arima.fit().summary())
                                   SARIMAX Results                                    
======================================================================================
Dep. Variable:     log_biz_machine_investment   No. Observations:                  123
Model:                         ARIMA(1, 1, 0)   Log Likelihood                 119.336
Date:                        Fri, 22 May 2020   AIC                           -230.672
Time:                                17:33:22   BIC                           -219.456
Sample:                            10-01-1972   HQIC                          -226.116
                                 - 04-01-2003                                         
Covariance Type:                          opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const       1.155e-13   9.14e-13      0.126      0.900   -1.68e-12    1.91e-12
x1             0.0101      0.007      1.468      0.142      -0.003       0.024
ar.L1         -0.2216      0.081     -2.723      0.006      -0.381      -0.062
sigma2         0.0083      0.001     11.192      0.000       0.007       0.010
===================================================================================
Ljung-Box (Q):                       43.43   Jarque-Bera (JB):                32.63
Prob(Q):                              0.33   Prob(JB):                         0.00
Heteroskedasticity (H):               0.33   Skew:                            -0.38
Prob(H) (two-sided):                  0.00   Kurtosis:                         5.42
===================================================================================

手动输入了exog_data的ARIMA(0,0,0),即将自己的滞后值添加到exog变量中

exog_data_without_lag = df.loc[:, ['log_biz_machine_investment', 'dlog_biz_machine_investment']]
endog = df.loc[:, 'dlog_biz_machine_investment']
maxlag = 1
exog_data = sm.tsa.tsatools.lagmat(df.dlog_biz_machine_investment, maxlag=maxlag, use_pandas=True)
exog_data = pd.concat([exog_data, df.log_biz_machine_investment.shift(1)], axis=1)
exog_data = exog_data.loc[start:end]

mod = sm.tsa.arima.ARIMA(df.dlog_biz_machine_investment.loc[start:end], exog=exog_data, order=(0,0,0), freq='QS', trend='ct', trend_offset=df.index.get_loc(start)+1)
results = mod.fit(method='innovations_mle')
print(results.summary())
                                    SARIMAX Results                                    
=======================================================================================
Dep. Variable:     dlog_biz_machine_investment   No. Observations:                  123
Model:                                   ARIMA   Log Likelihood                 123.957
Date:                         Fri, 22 May 2020   AIC                           -237.913
Time:                                 17:31:35   BIC                           -223.852
Sample:                             10-01-1972   HQIC                          -232.202
                                  - 04-01-2003                                         
Covariance Type:                           opg                                         
===================================================================================================
                                      coef    std err          z      P>|z|      [0.025      0.975]
---------------------------------------------------------------------------------------------------
const                               0.4019      0.178      2.264      0.024       0.054       0.750
drift                               0.0013      0.001      2.482      0.013       0.000       0.002
dlog_biz_machine_investment.L.1    -0.1960      0.082     -2.403      0.016      -0.356      -0.036
log_biz_machine_investment         -0.1146      0.050     -2.271      0.023      -0.213      -0.016
sigma2                              0.0078      0.001     11.727      0.000       0.006       0.009
===================================================================================
Ljung-Box (Q):                       45.13   Jarque-Bera (JB):                59.25
Prob(Q):                              0.27   Prob(JB):                         0.00
Heteroskedasticity (H):               0.32   Skew:                            -0.53
Prob(H) (two-sided):                  0.00   Kurtosis:                         6.23
===================================================================================

这导致回归结果有所不同。漂移项应同时出现在两个结果中。

0 个答案:

没有答案