# GRS Test in R with robust residuals

I'm testing certain asset pricing factor models (e.g. Fama and French 3 factor model) and want to check if the alphas of my time series regressions are jointly zero.

Most papers use the Gibbons, Ross, Shanken (1989) Test to do so.

I buildt the test by myself in R, but I want to do it with robust residuals. How do I get them, corrected for heteroscedasticity and autocorrelation with e.g. Newey West?

This is how my regressions looks like:

FF3 <- lm(Excess_Return ~ RMRF + SMB + HML)


If I do:

FF3_corrected <- coeftest(FF3, vcov = NeweyWest)


Then R just shows me the corrected coefficients, but I need the corrected residuals...

• Not an answer to your question but you might be aware of using the additional option ‚prewhite = FALSE‘ in the coeftest function to get the original Newey/West (1987) standard errors. Jun 28 '20 at 18:55
• Good Point, thanks! Jun 28 '20 at 19:07
• Btw, what do you mean when you ask for corrected residuals? Point estimates of coefficients (and thus of residuals) remain exactly the same, whether you correct for robust standard errors or not. Jun 30 '20 at 20:35
• But if I want to calculate R^2 of my model. Then I get missleading results, no? Jul 2 '20 at 12:39
• Actually not - the residuals remain numerically exactly the same. It is just the standard deviation (standard error in this context) of the estimated regression coefficients that change. Jul 8 '20 at 7:38

You can do the following:

Load the sandwich package, which is used for correcting covariance matrices.

library(sandwich)


Run the model.

FF3 <- lm(Excess_Return ~ RMRF + SMB + HML)


Obtain the NeweyWest-corrected covariance matrix. Change the "lag" argument if you have a specific lag structure in mind.

rcovmatrix <- NeweyWest(FF3)


The corrected standard errors are the square root of the diagonal of this matrix:

rstderrors <- sqrt(diag(rcovmatrix))
rstderrors

• Sorry, but I need the corrected residuals, not the standard errors... Jun 30 '20 at 13:20
• Alright, sorry, I misunderstood.
– Alba
Jun 30 '20 at 19:11