Newey West – Finding the Optimal Lag for Newey West Regression

neweywestregressiontime series

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

library(sandwich) 
library(lmtest)
library(dynlm)


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

Best Answer

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():

bwNeweyWest(m)
## [1] 3.032204

The lag length is just floor() of that.