Economics at your fingertips  

Various Versatile Variances: An Object-Oriented Implementation of Clustered Covariances in R

Susanne Berger (), Nathaniel Graham () and Achim Zeileis ()

Working Papers from Faculty of Economics and Statistics, University of Innsbruck

Abstract: 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 variety of 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, functions for covariances in clustered or panel models have been somewhat scattered or available only for certain modeling functions, notably the (generalized) linear regression model. In contrast, an object-oriented approach to "robust" covariance matrix estimation - applicable beyond lm() and glm() - is available in the sandwich package but has been limited to the case of cross-section or time series data. Now, this shortcoming has been corrected in sandwich (starting from version 2.4.0): Based on methods for two generic functions (estfun() and bread()), clustered and panel covariances are now provided in vcovCL(), vcovPL(), and vcovPC(). These are directly applicable to models from many packages, e.g., including MASS, pscl, countreg, betareg, among others. Some empirical illustrations are provided as well as an assessment of the methods' performance in a simulation study.

Keywords: clustered data; clustered covariance matrix estimators; object orientation; simulation; R (search for similar items in EconPapers)
JEL-codes: C12 C52 C87 (search for similar items in EconPapers)
Pages: 38 pages
Date: 2017-07
New Economics Papers: this item is included in nep-ecm and nep-ore
References: View references in EconPapers View complete reference list from CitEc
Citations: View citations in EconPapers (4) Track citations by RSS feed

Downloads: (external link) (application/pdf)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link:

Access Statistics for this paper

More papers in Working Papers from Faculty of Economics and Statistics, University of Innsbruck Contact information at EDIRC.
Bibliographic data for series maintained by Janette Walde ().

Page updated 2023-03-28
Handle: RePEc:inn:wpaper:2017-12