Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others


0 votes
in Technique[技术] by (71.8m points)

statsmodels - HC and HAC in SARIMAX

I can use HC and HAC without issues in the OLS framework in statsmodels. Can somebody tell me how to use it in SARIMAX framework?

import statsmodels.api as sm
res_ols = sm.OLS(y, X).fit(cov_type='HC3')
              Coef.    Std.Err.      z      P>|z|     [0.025   0.975]
Intercept    -0.0001     0.0014   -0.0756   0.9398   -0.0028   0.0026
oney          0.7919     0.0166   47.7080   0.0000    0.7594   0.8245

from statsmodels.tsa.statespace.sarimax import SARIMAX
res_sarimax = SARIMAX(y,X, order=(0,0,0)).fit()
                 coef    std err          z      P>|z|      [0.025      0.975]
Intercept     -0.0001      0.001     -0.079      0.937      -0.003       0.003
oney           0.7919      0.003    232.920      0.000       0.785       0.799
sigma2         0.0048   8.07e-05     58.906      0.000       0.005       0.005

You can see in the outputs above that the coefficients are the same but the std err are much more constrained in OLS with heteroskedasticity correction applied. How can I impose these correction in SARIMAX version.

Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

SARIMAX has the option cov_type='robust', which provides an set of standard errors that may be valid even in the presence of some misspecifications.

Note that these are slightly different in their details than the OLS robust standard error options, because SARIMAX estimated parameters via numerical maximum likelihood techniques.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share