Skip to main content
2 of 2
added 136 characters in body

The GRS test assumes returns are homoscedastic with no auto-correlation. For a robust test, using GMM is recommended (see Cochrane's Asset Pricing p230-235). This can be easily implemented using the gmm package. The package's vignette (section 3.5) provides an example for testing the CAPM using time-series regression. This is the GRS test (assuming one factor that's the market) except a GMM approach is additionally robust to heteroscedasticity and auto-correlation. Here's the example code (using the Finance dataset in the gmm package and also invoking linearHypothesis() in the car package):

data(Finance) # load data
r <- Finance[1:500,1:5]
rm <- Finance[1:500,"rm"]
rf <- Finance[1:500,"rf"]

z <- as.matrix(r-rf)
zm <- as.matrix(rm-rf)
res <- gmm(z~zm,x=zm) # use gmm 

R <- cbind(diag(5),matrix(0,5,5)) # conduct test for the intercepts only and not the betas (in this example there are 5 test assets)
c <- rep(0,5) # test that all 5 intercepts equal 0
linearHypothesis(res,R,c,test = "Chisq") # perform test