Theoretical background: White's heteroskedasticity-consistent (HC) standard errors and Newey-West's heteroskedasticity- and autocorrelation-consistent (HAC) standard errors are closely related. When you set the lag parameter for the latter method to zero, you get the same covariance matrix as with the former method. See e.g. the last two pages of Stata's documentation of its implementation of Newey-West.
However, I have not been able to replicate this theoretical result in R with the lmtest
and sandwich
libraries, by a wide margin. In theory, the second and the third line of my code should yield the same standard errors, but they do not.
fit = lm(y ~ x) # Set up the model
coeftest(fit, vcov.=vcovHC(model, type="HC1")) # White's HC errors
coeftest(fit, vcov.=NeweyWest(model, lag=0, adjust=TRUE, verbose=TRUE)) # Newey-West's HAC errors
See the documentation for the vcovHC
function here and the difference between the different options for the parameter type
on p. 4 of this document. See the documentation for the NeweyWest
function here. The type="HC1"
option in the second line produces White's HC standard errors with a small-sample adjustment of n/(n-k); the adjust=TRUE
option in the third line should produce Newey-West's HAC standard errors with the same small-sample adjustment.
Importantly, I am able to completely replicate R's results for White with a different software but R's results for Newey-West with lag 0 are different from R's own results for White (which they shouldn't be) and from my separate results for Newey-West with lag 0. Why is this the case? See the results that I obtained with R below.
Result for second line (White):
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.777621 0.066873 11.6284 < 2e-16 ***
Du -0.527864 0.268446 -1.9664 0.05241 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Result for third line (Newey-West):
Lag truncation parameter chosen: 0
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.77762 0.12968 5.9966 4.357e-08 ***
Du -0.52786 0.33472 -1.5770 0.1184
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(For the record, I did think about posting this question on StackOverflow vs posting it here. Ultimately, I decided to post it here because I think this community will be more likely (i) to understand the theory behind the equivalency of HC and HAC errors with lag=0 for the latter and (ii) to perhaps have encountered this problem before.)