I have a panel data set in R (time and cross section) and would like to compute standard errors that are clustered by two dimensions, because my residuals are correlated both ways. Googling around I found http://thetarzan.wordpress.com/2011/06/11/clustered-standard-errors-in-r/ which provides a function to do this. It seems a bit ad-hoc so I wanted to know if there is a package that has been tested and does this?
I know sandwich does HAC standard errors, but it doesn’t do double clustering (i.e. along two dimensions).
Frank Harrell’s package
rms(which used to be namedDesign) has a function that I use often when clustering:robcov.See this part of
?robcov, for example.