5
$\begingroup$

The Python package statsmodels provides a use_correction option when computing HAC standard errors for an OLS model, which purportedly corrects for small sample size. When I dug into the code however, I encountered the following comment:

just guessing on correction factor, need reference

This caused a little alarm, since this correction factor significantly affects the interpretation of my fit.

The correction factor, as far as I understand the code, seems to consist in simply multiplying the usual HAC covariance matrix with $n / (n - k)$, where $n$ is the number of observations and $k$ the number of parameters in the model. While this seems plausible, I am no expert, and would very much (like the code's author) appreciate a justification or reference for this factor.

$\endgroup$
8
  • 1
    $\begingroup$ If I'm not mistaken, the code uses "HC1", in the terminology of Long & Ervin (2000) which can serve as a reference. $\endgroup$ Commented Nov 25, 2021 at 14:10
  • $\begingroup$ @COOLSerdash An excellent reference, thank you. The $N/(N_K)$ does indeed appear in the formula for HC1. I'm missing however the "autocorrelation" part of the HAC in your article: statsmodels does have different options for HC0 and HAC: statsmodels.org/dev/generated/… $\endgroup$
    – Anthony
    Commented Nov 25, 2021 at 14:32
  • $\begingroup$ @COOLSerdash It seems as though statsmodels is computing the equivalent of HC1 in the article you linked to, but for the HAC covariance matrix instead of the HC0 one. $\endgroup$
    – Anthony
    Commented Nov 25, 2021 at 14:34
  • 1
    $\begingroup$ This recent question is related: the correction factor would make the matrix estimator conditionally unbiased under a homoskedastic and "balanced" design: stats.stackexchange.com/questions/552311/… $\endgroup$ Commented Nov 26, 2021 at 7:19
  • 1
    $\begingroup$ Ad (i), to me, HC1 stands for version 1 of a "heteroskedasticity consistent" variance estimator, while HAC stands for "heteroskedasticity and autocorrelation consistent". See e.g. stats.stackexchange.com/questions/139221/… and stats.stackexchange.com/questions/153444/… for the idea of the latter. (ii) The justification I gave in my comment would then (or so I'd say) not hold anymore, but it could still be an ad hoc correction that is useful) (iii) rather $1/(1-k/n)^2$, I'd say $\endgroup$ Commented Nov 26, 2021 at 9:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.