fwildclusterboot package is an R port of STATA’s
It implements the fast wild cluster bootstrap algorithm developed in
Roodman et al
regression objects in R. It currently works for regression objects of
fixest from base R and the
The package’s central function is
boottest(). It allows the user to
test two-sided, univariate hypotheses using a wild cluster bootstrap.
Importantly, it uses the “fast” algorithm developed in Roodman et al,
which makes it feasible to calculate test statistics based on a large
number of bootstrap draws even for large samples – as long as the number
of bootstrapping clusters is not too large.
fwildclusterboot package currently supports multi-dimensional
clustering and one-dimensional, two-sided hypotheses. It supports
regression weights, multiple distributions of bootstrap weights, fixed
effects, restricted (WCR) and unrestricted (WCU) bootstrap inference and
subcluster bootstrapping for few treated clusters (MacKinnon & Webb,
library(fixest) library(fwildclusterboot) data(voters) # fit the model via fixest::feols(), lfe::felm() or stats::lm() feols_fit <- feols(proposition_vote ~ treatment + log_income | Q1_immigration + Q2_defense, data = voters) # bootstrap inference via boottest() feols_boot <- boottest(feols_fit, clustid = c("group_id1"), B = 9999, param = "treatment") summary(feols_boot) #> boottest.fixest(object = feols_fit, clustid = c("group_id1"), #> param = "treatment", B = 9999) #> #> Observations: 300 #> Bootstr. Type: rademacher #> Clustering: 1-way #> Confidence Sets: 95% #> Number of Clusters: 40 #> #> term estimate statistic p.value conf.low conf.high #> 1 treatment 0.079 4.123 0 0.039 0.118
For a longer introduction to the package’s key function,
please follow this
Results of timing benchmarks of
boottest(), with a sample of N =
50000, k = 19 covariates and one cluster of dimension N_G (10
You can install
fwildclusterboot from CRAN or the development version
from github by following the steps below:
# from CRAN install.packages("fwildclusterboot") # dev version from github # note: installation requires Rtools library(devtools) install_github("s3alfisc/fwildclusterboot")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.