I'm currently trying to use Newey-West standard errors accounting for Heteroskedasticity and Autocorrelation with the sandwich package in R, but i lack understanding as i can not fully grasp the instructions provided in the manual.
library(sandwich) ## fit investment equation data(Investment) fm <- lm(RealInv ~ RealGNP + RealInt, data = Investment) summary(fm) ## Newey & West (1994) (Heteroskedasticity and Autocorrelationconsistent; HAC) ## Covariance Matrix Estimation NeweyWest(fm) ## The Newey & West (1987) estimator requires specification ## of the lag and suppression of prewhitening NeweyWest(fm, lag = 4, prewhite = FALSE)
Unfortunately that's all the information the authors provide. I understand that it is only the estimated HAC Variance-Covariance Matrix but how do you proceed from there to obtain valid standard errors and t-statistics? And is my assumption correct that if you don't specify the lag, the bwNeweyWest function automatically selects the number of relevant lags?