5
$\begingroup$

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?

$\endgroup$
1
  • 1
    $\begingroup$ Edit: I was able to use the lmtest package with the coeftest function where you can just choose which VCV-Matrix you would like to perform the Coefficient tests. $\endgroup$
    – Gritti
    Jul 17, 2014 at 10:11

0

Browse other questions tagged or ask your own question.