Keywords: clustered data, clustered covariance matrix estimators, object-orientation, simulation,
R Webpages:
http://R-forge.R-project.org/projects/sandwich/ Clustered covariances or clustered standard errors are very widely used to account for correlated or clustered data, especially in economics, political sciences, or other social sciences. They are employed to adjust the inference following estimation of a standard least-squares regression or generalized linear model estimated by maximum likelihood. Although many publications just refer to “the” clustered standard errors, there is a surprisingly wide variation in clustered covariances, particularly due to different flavors of bias corrections. Furthermore, while the linear regression model is certainly the most important application case, the same strategies can be employed in more general models (e.g. for zero-inflated, censored, or limited responses).
In
R, the
sandwich package (Zeileis 2004; Zeileis 2006) provides an object-oriented approach to “robust” covariance matrix estimation based on methods for two generic functions (estfun() and bread()). Using this infrastructure, sandwich covariances for cross-section or time series data have been available for models beyond lm() or glm(), e.g., for packages
MASS,
pscl,
countreg,
betareg, among many others. However, corresponding functions for clustered or panel data have been somewhat scattered or available only for certain modeling functions. This shortcoming has been corrected in the development version of
sandwich on R-Forge. Here, we introduce this new object-oriented implementation of clustered and panel covariances and assess the methods’ performance in a simulation study.
References Zeileis, Achim. 2004. “Econometric Computing with HC and HAC Covariance Matrix Estimators.”
Journal of Statistical Software 11 (10): 1–17.
http://www.jstatsoft.org/v11/i10/.
———. 2006. “Object-Oriented Computation of Sandwich Estimators.”
Journal of Statistical Software 16 (9): 1–16.
http://www.jstatsoft.org/v16/i09/.