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

WildBootTests.jl 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).

The package offers and/or supports:

  • The wild bootstrap for OLS (Wu 1986).
  • The Wild Restricted Efficient bootstrap (WRE) for IV/2SLS/LIML (Davidson and MacKinnon 2010).
  • The subcluster bootstrap (MacKinnon and Webb 2018).
  • 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) for OLS and IV/2SLS. 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 DataFrames or results from estimation functions such as lm(). This design minimizes the package’s dependency footprint while making the core functionality available to multiple programming environments, including Julia, R (through JuliaConnectoR), and Python (through 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.

Comments welcome.

4 Likes

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

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.

I’m not aware of any precedent. JuMP allows declaring constraints but that’s a bit different.

2 Likes