This package implements the small-sample degrees of freedom adjustments for robust and cluster-robust standard errors in linear regression described in Imbens and Kolesár (2016).
SAS version by Nicolas Moreau is available here.
See vignette dfadjust for description of the package
(available through vignette("dfadjust")
once package is installed), and the
package manual for documentation of the package functions.
No clustering:
set.seed(42)
x <- sin(1:10)
y <- rnorm(10)
fm <- lm(y~x)
dfadjustSE(fm)
Clustering:
clustervar <- as.factor(c(rep(1, 6), rep(2, 2), rep(3, 2)))
dfadjustSE(fm, clustervar)
Here we defined the first six observations to be in cluster 1, the next two in cluster 2, and the last three in cluster three.
You can install the released version of dfadjust
from
CRAN with:
install.packages("dfadjust")
Alternatively, you can get the current development version from GitHub:
if (!requireNamespace("remotes")) {
install.packages("remotes")
}
remotes::install_github("kolesarm/Robust-Small-Sample-Standard-Errors")