This repository explains and illustrates a variety of Cluster-Robust Heteroskedasticity-Consistent Standard Error estimators. It was created by Düzgün Dilsiz (University of Basel) for teaching purposes. Note that there is also a website version.
Heteroskedasticity-Consistent (HC) Standard Errors (SE) allow different units having different variance of the error term, rather than assuming all units having the same variance of the error term. In addition to this, cluster-robust HC SE allow for correlation within a cluster. In the following the estimated asymptotic variance for the panel data fixed effects estimator is presented for the standard small sample size correction
(Stata
and R
), and the HC0-HC3
estimators, as computed by the function vcovHC
(plm
package) in R
.
STATA SSS:
R SSS:
R HC0:
R HC1:
R HC2:
R HC3:
where HC2
and HC3
, and
In the code, you find a small example with crime data from the United States where all the estimators are computed and it is shown that the results are identical to when using the provided functions directly.
This repository consists of 2 folders:
- code: provides the
R
-code for cluster-robustHC0-HC3
standard error estimators with examples - pictures: resources for website version
This work is licensed under a Creative Commons Attribution 4.0 International License.