fwildclusterboot package is an R port of STATA’s boottest package.
It implements the fast wild cluster bootstrap algorithm developed in Roodman et al (2019) for regression objects in R. It currently works for regression objects of type
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, (2018)).
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.119
Results of timing benchmarks of
boottest(), with a sample of N = 50000, k = 19 covariates and one cluster of dimension N_G (10 iterations each).