cluster-robust
Guide for cluster-robust heteroskedasticity-consistent standard errors
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.1%) to scientific vocabulary
Repository
Guide for cluster-robust heteroskedasticity-consistent standard errors
Basic Info
- Host: GitHub
- Owner: d-dilsiz
- License: cc-by-4.0
- Language: R
- Default Branch: main
- Size: 383 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Cluster-Robust Heteroskedasticity-Consistent Standard Errors
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: $\widehat{Avar}\left[\widehat \beta{FE}\right]$ = $\frac{N}{N-1}$ $\frac{NT-1}{NT-K-1}$ $\left(\ddot X' \ddot X \right)^{-1}$ $\Sigma{i=1}^{N}{\ddot X{i}'\widehat{\ddot u{i}} \widehat{\ddot u{i}'}\ddot X{i}}$ $\left(\ddot X' \ddot X\right)^{-1}$
R SSS: $\widehat{Avar}\left[\widehat \beta{FE}\right]$ = $\frac{N}{N-1}$ $\frac{NT-1}{NT-K}$ $\left(\ddot X' \ddot X \right)^{-1}$ $\Sigma{i=1}^{N}{\ddot X{i}'\widehat{\ddot u{i}} \widehat{\ddot u{i}'}\ddot X{i}}$ $\left(\ddot X' \ddot X\right)^{-1}$
R HC0: $\widehat{Avar}\left[\widehat \beta{FE}\right]$ = $\left(\ddot X' \ddot X \right)^{-1}$ $\Sigma{i=1}^{N}{\ddot X{i}'\widehat{\ddot u{i}} \widehat{\ddot u{i}'}\ddot X{i}}$ $\left(\ddot X' \ddot X\right)^{-1}$
R HC1: $\widehat{Avar}\left[\widehat \beta{FE}\right]$ = $\frac{NT}{NT-K}$ $\left(\ddot X' \ddot X \right)^{-1}$ $\Sigma{i=1}^{N}{\ddot X{i}'\widehat{\ddot u{i}} \widehat{\ddot u{i}'}\ddot X{i}}$ $\left(\ddot X' \ddot X\right)^{-1}$
R HC2: $\widehat{Avar}\left[\widehat \beta{FE}\right]$ = $\left(\ddot X' \ddot X \right)^{-1}$ $\Sigma{i=1}^{N}{\ddot X{i}'\tilde{\ddot u{i}} \tilde{\ddot u{i}}'\ddot X{i}}$ $\left(\ddot X' \ddot X\right)^{-1}$
R HC3: $\widehat{Avar}\left[\widehat \beta{FE}\right]$ = $\left(\ddot X' \ddot X \right)^{-1}$ $\Sigma{i=1}^{N}{\ddot X{i}'\tilde{\ddot u{i}} \tilde{\ddot u{i}}'\ddot X{i}}$ $\left(\ddot X' \ddot X\right)^{-1}$
where $\tilde{\ddot u{it}}=\widehat{\ddot u{i}}(1-\ddot h{it})^{-\delta{m}}$ where m=0.5 for HC2 and $m=1$ for HC3, and $\ddot h{it}$ indicating the diagonal elements of $\ddot H{jj}$ of the hat matrix $\ddot H = \ddot X\left(\ddot X' \ddot X \right)^{-1}\ddot X'$.
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.
File structure
This repository consists of 2 folders:
* code: provides the R-code for cluster-robust HC0-HC3 standard error estimators with examples
* pictures: resources for website version
License

This work is licensed under a Creative Commons Attribution 4.0 International License.
Owner
- Login: d-dilsiz
- Kind: user
- Repositories: 1
- Profile: https://github.com/d-dilsiz
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: >-
Cluster-Robust Heteroskedasticity-Consistent Standard
Errors
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Düzgün
family-names: Dilsiz
email: d.dilsiz@unibas.ch
affiliation: University of Basel
repository-code: 'https://github.com/d-dilsiz/cluster-robust/tree/main'
url: 'https://d-dilsiz.github.io/cluster-robust/'
abstract: >-
This repository explains and illustrates a variety of
cluster-robust heteroskedasticity-consistent standard
error estimators
license: CC-BY-4.0