WildBootTests.wildboottest — Functionwildboottest([T::DataType=Float64,] R::AbstractMatrix, r::AbstractVector; resp, <optional keyword arguments>) -> WildBootTests.BootTestResult
Function to perform wild-bootstrap-based hypothesis test
Positional arguments
T::DataType: data type for inputs, results, and computations: Float32 or Float64 (default)R::AbstractMatrixandr::AbstractVector: required matrix and vector expressing the null Rβ=r; see notes below
Required keyword argument
resp::AbstractVector: response/dependent variable (y or y₁ in Roodman et al. (2019))
Optional keyword arguments
predexog::AbstractVecOrMat: exogenous predictors, including constant term, if any (X/X₁)predendog::AbstractVecOrMat: endogenous predictors (Y₂)inst::AbstractVecOrMat: instruments (X₂)R1::AbstractMatrixandr1::AbstractVector: model constraints; same format as forRandrclustid::AbstractVecOrMat{<:Integer}: data vector/matrix of error and bootstrapping cluster identifiers; see notesnbootclustvar::Integer=size(clustid,2): number of bootstrap-clustering variablesnerrclustvar::Integer=nbootclustvar: number of error-clustering variablesissorted:Bool=false: time-saving flag: data matrices are already sorted by column types 2, then 3, then 1 (see notes)hetrobust::Bool=true: true unless errors are treated as iidfeid::AbstractVector{<:Integer}: data vector for one-way fixed effect group identifierfedfadj::Integer: degrees of freedom that fixed effects (if any) consume; defaults to number of FEsobswt::AbstractVector=[]: observation weight vector; default is equal weightingfweights::Bool=false: true for frequency weightsmaxmatsize::Number: maximum size of auxilliary weight matrix (v), in gigabytesptype::Symbol=:symmetric: p value type (:symmetric,:equaltail,:lower,:upper)bootstrapc::Bool=false: true to request bootstrap-c instead of bootstrap-tliml::Bool=false: true for LIML or Fuller LIMLfuller::Number: Fuller LIML factorkappa::Number: fixed κ for k-class estimationarubin::Bool=false: true for Anderson-Rubin testsmall::Bool=true: true to multiply test statistics by G/(G-1) × N/(N-k), where G, N, k are number of clusters, observations, and predictorsclusteradj::Bool=true: false to drop G/(G-1) factorclustermin::Bool=false`: for multiway clustering, true to base G/(G-1) factor for all clusterings ]on the smallest G across clusteringsjk::Bool=false: true to base the bootstrap data-generating process on residuals jackknifed by bootstrap clusterscorebs::Bool=false: true for score bootstrap instead of wild bootstrapreps::Integer=999: number of bootstrap replications;reps= 0 requests classical Rao (or Wald) test ifimposenull=true(orfalse)imposenull::Bool=true: true to impose nullauxwttype::Symbol=:rademacher: auxilliary weight type (:rademacher,:mammen,:webb,:normal,:gamma)rng::AbstractRNG=MersenneTwister(): randon number generatorlevel::Number=.95: significance level (0-1)rtol::Number=1e-3: tolerance for confidence set bound determinationmadjtype::Symbol=:none: multiple hypothesis adjustment (:none,:bonferroni,:sidak)nH0::Integer=1: number of hypotheses tested, including one being tested nowml::Bool=false: true for (nonlinear) ML estimationscores::AbstractVecOrMat: for ML, pre-computed scoresbeta::AbstractVector: for ML, parameter estimatesA::AbstractMatrix: for ML, covariance estimatesgridmin: vector of graph lower bounds; max length 2,missing/NaNentries ask wildboottest() to choosegridmax: vector of graph upper bounds;missing/NaNentries ask wildboottest() to choosegridpoints: vector of number of sampling points;missing/NaNentries ask wildboottest() to choosegetdist::Bool=:false: whether to return bootstrapped distribution for t/z/F/χ² statistics; and their numeratorsgetci::Bool=true: whether to return confidence intervalgetplot::Bool=getci: whether to generate plot datagetauxweights::Bool=false: whether to save auxilliary weight matrix (v)
Notes
T, ptype, auxwttype, and madjtype may also be strings. Examples: "Float32" and "webb".
The columns of R in the statement of the null should correspond to those of the matrix [predexog predendog], where predendog is non-empty only in regressions with instruments.
Order the columns of clustid this way:
- Variables only used to define bootstrapping clusters, as in the subcluster bootstrap.
- Variables used to define both bootstrapping and error clusters.
- Variables only used to define error clusters.
nbootclustvar is then the number of columns of type 1 or 2; nerrclustvar is the number of columns of type 2 or 3. Typically clustid is a single column of type 2 and nbootclustvar and nerrclustvar default to 1.
wildboottest() does not handle missing data values: all data and identifier matrices must be restricted to the estimation sample.
WildBootTests.teststat — Functionteststat(::WildBootTests.BootTestResult{T}) -> T
Given a wildboottest() return object, extract test statistic
WildBootTests.stattype — Functionstattype(::WildBootTests.BootTestResult{T}) -> String
Given a wildboottest() return object, extract type of test statistic: "t", "z", "F", or "χ²"
WildBootTests.p — Functionp(::WildBootTests.BootTestResult{T}) -> T
Given a wildboottest() return object, extract p value
WildBootTests.padj — Functionpadj(::WildBootTests.BootTestResult{T}) -> T
Given a wildboottest() return object, extract p value after multiple-hypothesis adjustment, if any
WildBootTests.reps — Functionreps(::WildBootTests.BootTestResult{T}) -> Int64
Given a wildboottest() return object, extract number of replications
WildBootTests.repsfeas — Functionrepsfeas(::WildBootTests.BootTestResult{T}) -> Int64
Given a wildboottest() return object, extract actual number of replications, subject to enumeration of Rademacher draws
WildBootTests.nbootclust — Functionnbootclust(::WildBootTests.BootTestResult{T}) -> Int64
Given a wildboottest() return object, extract number of bootstrapping clusters in test
WildBootTests.dof — Functiondof(::WildBootTests.BootTestResult{T}) -> Int64
Given a wildboottest() return object, extract degrees of freedom of test
WildBootTests.dof_r — Functiondof_r(::WildBootTests.BootTestResult{T}) -> Int64
Given a wildboottest() return object, extract residual degrees of freedom of test
WildBootTests.plotpoints — Functionplotpoints(::WildBootTests.BootTestResult{T}) -> NamedTuple{(:X, :p), Tuple{Tuple{Vararg{Vector{T}, N} where N},Vector{T}}}
Return data for confidence plot of test. Return value is a 2-tuple with named entries X and p holding the confidence sampling locations and p values respectively. X is in turn a 1- or 2-tuple of vectors of sampling coordinates for each dimension of the tested hypothesis.
WildBootTests.peak — Functionpeak(::WildBootTests.BootTestResult{T}) -> NamedTuple{(:X, :p), Tuple{Vector{T}, T}}
Given a wildboottest() return object for a one-dimensional test, return the parameter value with peak p value in test Return value is a 2-tuple with named entries X and p holding the parameter value and p value.
WildBootTests.ci — Functionci(::WildBootTests.BootTestResult{T}) -> Matrix{T}
Given a wildboottest() return object for a one-dimensional test, extract the confidence interval(s) for test, one row per disjoint piece
WildBootTests.dist — Functiondist(::WildBootTests.BootTestResult{T}) -> Matrix{T}
Given a wildboottest() return object, extract bootstrap distribution of statistic
WildBootTests.statnumer — Functionstatnumer(::WildBootTests.BootTestResult{T}) -> T
Given a wildboottest() return object, extract numerator of test statistic
WildBootTests.statvar — Functionstatvar(::WildBootTests.BootTestResult{T}) -> T
Given a wildboottest() return object, extract squared denominator of test statistic
WildBootTests.auxweights — Functionauxweights(::WildBootTests.BootTestResult{T}) -> Matrix{T}
Given a wildboottest() return object for a one-dimensional test, extract auxilliary weight matrix