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

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
    Jun 30 '20 at 13:20
  • $\begingroup$ Alright, sorry, I misunderstood. $\endgroup$
    – Alba
    Jun 30 '20 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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