I am currently working on my PhD thesis and was wondering how I can identify the optimal number of lags for the Newey West covariance matrix. So far, my code is


Regression <- dynlm(y ~ x)
coeftest(Regression, vcov = NeweyWest(Regression, lag = NULL))

Since I have to compare coefficients of multiple regressions (for the same time series), I should use the same lag as well. However is there a rule of thumb or a simple method to get the lag?

Thank you and best regards

  • $\begingroup$ When you specify null to lag, the function automatically estimates the number of lags to use $\endgroup$ – Repmat Jan 11 '17 at 17:45
  • $\begingroup$ Thank you very much Repmat. But shouldn't I use just one fixed lag for all regressions? $\endgroup$ – user144267 Jan 12 '17 at 21:40
  • $\begingroup$ Well that depends on the residuals, which are likely different across model's $\endgroup$ – Repmat Jan 13 '17 at 8:32
  • $\begingroup$ Exactly, but when I compare regression models, they should use the same lag, right? $\endgroup$ – user144267 Jan 14 '17 at 8:15

I don't think that you necessarily need to fix the lag length across regressions. Due to the different model specifications there may be slightly different amounts of autocorrelation in the residuals that you have to adjust for.

However, you can easily display the lag length employed by NeweyWest() and also extract it using bwNeweyWest(). For simple replication, let's consider the following (non-sensical because non-time-series) linear model:

m <- lm(dist ~ speed, data = cars)
NeweyWest(m, lag = NULL, verbose = TRUE)
## Lag truncation parameter chosen: 3 
##             (Intercept)      speed
## (Intercept)   49.250542 -3.7390757
## speed         -3.739076  0.3035406

The bandwidth estimation is done by bwNeweyWest():

## [1] 3.032204

The lag length is just floor() of that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.