# New: WildBootTests for wild-bootstrap-based inference on linear models

**URL:** <https://discourse.julialang.org/t/new-wildboottests-for-wild-bootstrap-based-inference-on-linear-models/73567>\
**Category:** Statistics\
**Tags:** package, announcement\
**Created:** [December 24, 2021, 1:26am UTC](https://discourse.julialang.org/t/new-wildboottests-for-wild-bootstrap-based-inference-on-linear-models/73567 "2021-12-24T01:26:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![droodman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/droodman/32/26652_2.png) [@droodman](https://discourse.julialang.org/u/droodman)\
**Post date:** [December 24, 2021, 1:26am UTC](https://discourse.julialang.org/t/new-wildboottests-for-wild-bootstrap-based-inference-on-linear-models/73567/1 "2021-12-24T01:26:23Z")

</div>

[WildBootTests.jl](https://droodman.github.io/WildBootTests.jl/dev/) is a Julia translation of the Stata package `boottest`, which is the most developed program for performing inference on linear models using the wild bootstrap. So it is algorithmically mature, but not quite polished as a Julia package.

From the documentation:

> WildBootTests.jl performs wild bootstrap-based hypothesis tests at extreme speed. It is intended mainly for linear models: ordinary least squares (OLS) and instrumental variables/two-stage least squares (IV/2SLS). For an introduction to the wild bootstrap and the algorithms deployed here, see [Roodman et al. (2019)](https://www.econ.queensu.ca/sites/econ.queensu.ca/files/qed_wp_1406.pdf).
> 
> The package offers and/or supports:
> 
> - The wild bootstrap for OLS ([Wu 1986](https://doi.org/10.1214/aos/1176350142)).
> - The Wild Restricted Efficient bootstrap (WRE) for IV/2SLS/LIML ([Davidson and MacKinnon 2010](https://doi.org/10.1198/jbes.2009.07221)).
> - The subcluster bootstrap ([MacKinnon and Webb 2018](https://doi.org/10.1111/ectj.12107)).
> - Non-bootstrapped Wald, Rao, and Anderson-Rubin tests, optionally with multiway clustering.
> - Confidence intervals formed by inverting the test and iteratively searching for bounds.
> - Multiway clustering.
> - Arbitrary and multiple linear hypotheses in the parameters.
> - Maintained linear constraints on the model (restricted OLS, IV/2SLS/LIML).
> - One-way fixed effects.
> - Generation of data for plotting of confidence curves or surfaces after one- or two-dimensional hypothesis tests.
> 
> WildBootTests.jl incorporates order-of-magnitude algorithmic speed-ups developed since [Roodman et al. (2019)](https://www.econ.queensu.ca/sites/econ.queensu.ca/files/qed_wp_1406.pdf) for [OLS](https://www.statalist.org/forums/forum/general-stata-discussion/general/1586107-boottest-just-as-wild-10x-faster) and [IV/2SLS](https://www.statalist.org/forums/forum/general-stata-discussion/general/1597888-boottest-~100x-faster-after-iv-gmm). And it exploits the efficiency of Julia, for example by offering single-precision ( `Float32` ) computation.
> 
> The interface is low-level: the exported function `wildboottest()` accepts scalars, vectors, and matrices, not [DataFrame](https://github.com/JuliaData/DataFrames.jl)s or results from estimation functions such as [lm()](https://juliastats.org/GLM.jl/v1.5/). This design minimizes the package’s dependency footprint while making the core functionality available to multiple programming environments, including Julia, R (through [JuliaConnectoR](https://cran.r-project.org/web/packages/JuliaConnectoR/index.html)), and Python (through [PyJulia](https://github.com/JuliaPy/pyjulia)). A separate package will provide a higher-level Julia interface.

I think the major piece of unfinished business is developing a way to represent and parse linear hypotheses about parameters. For example, if the linear model is y ~ 1 + x1 + x2, it would be nice if the user could express the hypothesis that the x1 coefficient plus twice the x2 coefficient is zero with an expression such as `x1 + 2 * x2 = 0`. Has such a language already been developed for Julia? I have not found it.

I am hopeful that this will be convenient to use from R and Python. Alexander Fischer is developing a front end for R, [wildboottestjlr](https://github.com/s3alfisc/wildboottestjlr).

Comments welcome.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [December 24, 2021, 10:49pm UTC](https://discourse.julialang.org/t/new-wildboottests-for-wild-bootstrap-based-inference-on-linear-models/73567/2 "2021-12-24T22:49:38Z")

</div>

Interesting! Just two drive-by comments, since you asked:

> [@droodman](#):
>
> The interface is low-level: the exported function `wildboottest()` accepts scalars, vectors, and matrices, not [DataFrame](https://github.com/JuliaData/DataFrames.jl)s or results from estimation functions such as [lm()](https://juliastats.org/GLM.jl/v1.5/). This design minimizes the package’s dependency footprint while making the core functionality available to multiple programming environments, including Julia, R (through [JuliaConnectoR](https://cran.r-project.org/web/packages/JuliaConnectoR/index.html)), and Python (through [PyJulia](https://github.com/JuliaPy/pyjulia)). A separate package will provide a higher-level Julia interface.

Note that using Tables.jl and StatsModels, you would be able to support any table-like source, including `DataFrame`, without depending on DataFrames. And if StatsModels is a too heavy dependency for you, you could make it optional using Requires.jl.

> [@droodman](#):
>
> I think the major piece of unfinished business is developing a way to represent and parse linear hypotheses about parameters. For example, if the linear model is y ~ 1 + x1 + x2, it would be nice if the user could express the hypothesis that the x1 coefficient plus twice the x2 coefficient is zero with an expression such as `x1 + 2 * x2 = 0` . Has such a language already been developed for Julia? I have not found it.

I’m not aware of any precedent. JuMP [allows declaring constraints](https://jump.dev/JuMP.jl/stable/manual/constraints/) but that’s a bit different.
