# How do joint test, r-squared behave when using autocorrelation / heteroskedasticity robust std. errors?

Recently we discussed on SO how to update a standard linear regression summary with NeweyWest standard errors. I used coeftestfrom the sandwich package. It was told to use unclass to update my already existing summary like this:

library(sandwich)
library(lmtest)
temp.lm <- lm(runif(100) ~ rnorm(100))
temp.summ <- summary(temp.lm)
temp.summ$coefficients <- unclass(coeftest(temp.lm, vcov. = NeweyWest)  Now I wonder whether the joint parameters shown in the summary aren't affected at all when using a NeweyWest VC matrix? I mean with this code they are not affected obviously – but is this correct? Note this is not a syntax but a stats question :) Stuff like Residual standard error: 1.177 on 83 degrees of freedom Multiple R-squared: 0.7265, Adjusted R-squared: 0.71 F-statistic: 44.1 on 5 and 83 DF, p-value: < 2.2e-16  remains the same. Are there any cases that need adjustment as well? ## 1 Answer The$R^2$is the sum of squared residuals divided by the total variation in your outcome; neither of these statistics change when robust/HAC standard errors are applied, so the$R^2$doesn't change either. Adjusted$R^2$alters the formula somewhat, but only based upon the number of observations and the number of predictors in your model, which don't change under robust standard errors, so this value remains unchanged as well. The F statistic can't incorporate heteroskedasticity or autocorrelation---it requires homoskedasticity and no correlations among the errors (actually, it requires that the errors be distributed according to identical normal distributions conditional on your predictors). This statistic can't be corrected. Instead, to perform robust joint tests, you need to use a Wald test that follows the$\chi^2\$ distribution under the null hypothesis. So, yes, the F statistic doesn't change when you apply the robust/HAC standard errors, but that's because it isn't robust.

• Thanks for the elaborate explanation. Still though this leaves me with a problem. Temp.summ in the example above still displays the f-statistic, even if only a Wald test would be meaningful. Is there a way to change that (also change the label)? Have you seen linear.hypothesis (deprecated) in Farnsworth Econometrics in R? cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf Sep 12, 2011 at 17:38
• @ran2, Yes the linear.hypothesis() function looks like it would work. So long as your getting a new package, this one might be simpler: hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/aod/html/… I assume that the R^2, F, etc output is from the LM function, right? Since you haven't specified the HAC standard errors at that point, you can't change that display. Sep 12, 2011 at 19:27
• yes it's from the LM function. True, I can't change the display initially, but what I do is update the coefficients after specifiying a NeweyWest VC matrix. Now that you helped me, the only thing I do to is another update for the joint tests. I´d like to update the joint test by using the Wald test summary. I am using summary to get nice Sweave base reports and would like to use that also for robust regression. Sep 13, 2011 at 7:30