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...

  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jun 28, 2020 at 18:55
  • $\begingroup$ Good Point, thanks! $\endgroup$
    – YemenBlues
    Commented Jun 28, 2020 at 19:07
  • $\begingroup$ 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. $\endgroup$ Commented Jun 30, 2020 at 20:35
  • $\begingroup$ But if I want to calculate R^2 of my model. Then I get missleading results, no? $\endgroup$
    – YemenBlues
    Commented Jul 2, 2020 at 12:39
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jul 8, 2020 at 7:38

1 Answer 1


You can do the following:

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


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))
  • $\begingroup$ Sorry, but I need the corrected residuals, not the standard errors... $\endgroup$
    – YemenBlues
    Commented Jun 30, 2020 at 13:20
  • $\begingroup$ Alright, sorry, I misunderstood. $\endgroup$
    – Alba
    Commented Jun 30, 2020 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.