MyNixOS website logo
Description

Fast Wild Cluster Bootstrap Inference for Linear Models.

Implementation of fast algorithms for wild cluster bootstrap inference developed in 'Roodman et al' (2019, 'STATA' Journal, <doi:10.1177/1536867X19830877>) and 'MacKinnon et al' (2022), which makes it feasible to quickly calculate bootstrap test statistics based on a large number of bootstrap draws even for large samples. Multiple bootstrap types as described in 'MacKinnon, Nielsen & Webb' (2022) are supported. Further, 'multiway' clustering, regression weights, bootstrap weights, fixed effects and 'subcluster' bootstrapping are supported. Further, both restricted ('WCR') and unrestricted ('WCU') bootstrap are supported. Methods are provided for a variety of fitted models, including 'lm()', 'feols()' (from package 'fixest') and 'felm()' (from package 'lfe'). Additionally implements a 'heteroskedasticity-robust' ('HC1') wild bootstrap. Last, the package provides an R binding to 'WildBootTests.jl', which provides additional speed gains and functionality, including the 'WRE' bootstrap for instrumental variable models (based on models of type 'ivreg()' from package 'ivreg') and hypotheses with q > 1.

fwildclusterboot

Lifecycle:maturing CRANstatus runiverse-package R-CMD-check Codecov testcoverage pkgcheck

The {fwildclusterboot} package implements multiple fast wild cluster bootstrap algorithms as developed in Roodman et al (2019) and MacKinnon, Nielsen & Webb (2022).

Via the JuliaConnectoR, {fwildclusterboot} further ports functionality of WildBootTests.jl - which provides an even faster implementation of the wild cluster bootstrap for OLS and supports the WRE bootstrap for IV and tests of multiple joint hypotheses.

The package’s central function is boottest(). It allows to test univariate hypotheses using a wild cluster bootstrap at extreme speed: via the ‘fast’ algorithm, it is possible to run a wild cluster bootstrap with $B = 100.000$ iterations in less than a second!

{fwildclusterboot} supports the following features:

  • The wild bootstrap for OLS (Wu 1986).
  • The wild cluster bootstrap for OLS (Cameron, Gelbach & Miller 2008, Roodman et al, 2019).
  • Multiple new versions of the wild cluster bootstrap as described in MacKinnon, Nielsen & Webb (2022), including the WCR13 (WCR-V), WCR31 (WCR-S), WCR33 (WCR-B), WCU13 (WCU-V), WCU31 (WCU-S) and WCU33 (WCU-B).
  • The subcluster bootstrap (MacKinnon and Webb 2018).
  • Confidence intervals formed by inverting the test and iteratively searching for bounds.
  • Multiway clustering.
  • One-way fixed effects.

Additional features are provided through WildBootTests.jl:

  • Highly optimized versions of the ‘11’ and ‘31’ wild cluster bootstrap variants
  • A highly optimized version of the Wild Restricted Efficient bootstrap (WRE) for IV/2SLS/LIML (Davidson & MacKinnon, 2010).
  • Arbitrary and multiple linear hypotheses in the parameters.

{fwildclusterboot} supports the following models:

  • OLS: lm (from stats), fixest (from fixest), felm from (lfe)
  • IV: ivreg (from ivreg).

Installation

You can install compiled versions of{fwildclusterboot} from CRAN (compiled), R-universe (compiled) or github by following one of the steps below:

# from CRAN 
install.packages("fwildclusterboot")

# from r-universe (windows & mac, compiled R > 4.0 required)
install.packages('fwildclusterboot', repos ='https://s3alfisc.r-universe.dev')
# dev version from github
# note: installation requires Rtools
library(devtools)
install_github("s3alfisc/fwildclusterboot")

The boottest() function

For a longer introduction to {fwildclusterboot}, take a look at the vignette.

library(fwildclusterboot)

# set seed via dqset.seed for engine = "R" & Rademacher, Webb & Normal weights
dqrng::dqset.seed(2352342)
# set 'familiar' seed for all other algorithms and weight types 
set.seed(23325)

data(voters)

# fit the model via fixest::feols(), lfe::felm() or stats::lm()
lm_fit <- lm(proposition_vote ~ treatment  + log_income + as.factor(Q1_immigration) + as.factor(Q2_defense), data = voters)
# bootstrap inference via boottest()
lm_boot <- boottest(lm_fit, clustid = c("group_id1"), B = 9999, param = "treatment")
#> Too guarantee reproducibility, don't forget to set a global random seed
#> **both** via `set.seed()` and `dqrng::dqset.seed()`.
#> This message is displayed once every 8 hours.
summary(lm_boot)
#> boottest.lm(object = lm_fit, param = "treatment", B = 9999, clustid = c("group_id1"))
#>  
#>  Hypothesis: 1*treatment = 0
#>  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 1*treatment = 0    0.079     3.983   0.001    0.039     0.119

Citation

If you are in R, you can simply run the following command to get the BibTeX citation for {fwildclusterboot}:

citation("fwildclusterboot")
#> 
#> To cite 'fwildclusterboot' in publications use:
#> 
#>   Fischer & Roodman. (2021). fwildclusterboot: Fast Wild Cluster
#>   Bootstrap Inference for Linear Regression Models. Available from
#>   https://cran.r-project.org/package=fwildclusterboot.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Misc{,
#>     title = {fwildclusterboot: Fast Wild Cluster Bootstrap Inference for Linear Regression Models (Version 0.12.4.3)},
#>     author = {Alexander Fischer and David Roodman},
#>     year = {2021},
#>     url = {https://cran.r-project.org/package=fwildclusterboot},
#>   }

Alternatively, if you prefer to cite the “Fast & Wild” paper by Roodman et al, it would be great if you mentioned {fwildclusterboot} in a footnote =) !

Metadata

Version

0.13.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows