ARIMA(1,0,0)和内生回归对外生变量的不同结果

2024-05-16 10:33:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在statsmodels中运行异方差的White测试。但是,其中一个参数需要一个外生变量数组。所以,我创建了一个带有常量、趋势和外生项的数据框架(见下文)

exog = sm.tsa.tsatools.lagmat(df.dlog_biz_machine_investment.dropna(), maxlag=1, use_pandas=True)
exog = sm.tsa.tsatools.add_trend(exog, trend='ct', prepend=True)
exog = pd.concat([exog, df.log_biz_machine_investment_L1.dropna()], axis=1)
mod = sm.tsa.arima.ARIMA(endog=df.dlog_biz_machine_investment.dropna(), exog=exog, freq='QS', trend='n').fit()
print(mod.summary())
>>> SARIMAX Results                                    
=======================================================================================
Dep. Variable:     dlog_biz_machine_investment   No. Observations:                  129
Model:                                   ARIMA   Log Likelihood                 122.929
Date:                         Tue, 05 May 2020   AIC                           -235.858
Time:                                 16:18:34   BIC                           -221.559
Sample:                             04-01-1971   HQIC                          -230.048
                                  - 04-01-2003                                         
Covariance Type:                           opg                                         
===================================================================================================
                                      coef    std err          z      P>|z|      [0.025      0.975]
---------------------------------------------------------------------------------------------------
const                               0.4551      0.190      2.397      0.017       0.083       0.827
trend                               0.0014      0.001      2.496      0.013       0.000       0.003
dlog_biz_machine_investment.L.1    -0.2043      0.084     -2.441      0.015      -0.368      -0.040
log_biz_machine_investment_L1      -0.1280      0.054     -2.370      0.018      -0.234      -0.022
sigma2                              0.0087      0.001     11.859      0.000       0.007       0.010
===================================================================================
Ljung-Box (Q):                       50.76   Jarque-Bera (JB):                48.15
Prob(Q):                              0.12   Prob(JB):                         0.00
Heteroskedasticity (H):               0.36   Skew:                            -0.23
Prob(H) (two-sided):                  0.00   Kurtosis:                         5.96
===================================================================================

上述应等同于ARIMA(1,0,0),以“dlog_biz_machine_investment”作为结束语,以一个滞后和一个趋势项log_biz_machine_investment(一个滞后)表示。然而,当我运行ARIMA(1,0,0)模型时,我得到了不同的结果(从技术上讲,我应该得到相同的答案)。这里有我遗漏的东西吗? 此外,我想知道是否有可能从ARIMAResults中获取外生值,这将省去我创建另一个数组用于White测试的麻烦。谢谢

mod = sm.tsa.arima.ARIMA(df.dlog_biz_machine_investment.dropna(), exog=df.log_biz_machine_investment_L1.dropna(), order=(1,0,0), freq='QS', trend='ct')
results = mod.fit()
print(results.summary())
>>> SARIMAX Results                                    
=======================================================================================
Dep. Variable:     dlog_biz_machine_investment   No. Observations:                  129
Model:                          ARIMA(1, 0, 0)   Log Likelihood                 122.067
Date:                         Tue, 05 May 2020   AIC                           -234.133
Time:                                 16:22:10   BIC                           -219.834
Sample:                             04-01-1971   HQIC                          -228.323
                                  - 04-01-2003                                         
Covariance Type:                           opg                                         
=================================================================================================
                                    coef    std err          z      P>|z|      [0.025      0.975]
-------------------------------------------------------------------------------------------------
const                             0.5641      0.171      3.307      0.001       0.230       0.898
drift                             0.0017      0.001      3.318      0.001       0.001       0.003
log_biz_machine_investment_L1    -0.1596      0.049     -3.277      0.001      -0.255      -0.064
ar.L1                            -0.1696      0.096     -1.769      0.077      -0.357       0.018
sigma2                            0.0088      0.001     11.728      0.000       0.007       0.010
===================================================================================
Ljung-Box (Q):                       54.55   Jarque-Bera (JB):                51.61
Prob(Q):                              0.06   Prob(JB):                         0.00
Heteroskedasticity (H):               0.38   Skew:                            -0.31
Prob(H) (two-sided):                  0.00   Kurtosis:                         6.03
===================================================================================

Tags: logmodl1dfmachinetrenddlogsm