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::AbstractMatrix
andr::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::AbstractMatrix
andr1::AbstractVector
: model constraints; same format as forR
andr
clustid::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
/NaN
entries ask wildboottest() to choosegridmax
: vector of graph upper bounds;missing
/NaN
entries ask wildboottest() to choosegridpoints
: vector of number of sampling points;missing
/NaN
entries 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
— FunctionReturn test statistic
WildBootTests.stattype
— FunctionReturn type of test statistic: "t", "z", "F", or "χ²"
WildBootTests.p
— FunctionReturn p value
WildBootTests.padj
— FunctionReturn p value after multiple-hypothesis adjustment, if any
WildBootTests.reps
— FunctionReturn requested number of replications
WildBootTests.repsfeas
— FunctionReturn actual number of replications, subject to enumeration of Rademacher draws
WildBootTests.nbootclust
— FunctionReturn number of bootstrapping clusters in test
WildBootTests.dof
— FunctionReturn degrees of freedom of test
WildBootTests.dof_r
— FunctionReturn residual degrees of freedom of test
WildBootTests.plotpoints
— FunctionReturn 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
— FunctionReturn parameter value with peak p value in test
WildBootTests.ci
— FunctionReturn confidence interval matrix from test, one row per disjoint piece
WildBootTests.dist
— FunctionReturn bootstrap distribution of statistic in bootstrap test
WildBootTests.statnumer
— FunctionReturn numerator of test statistic
WildBootTests.statvar
— FunctionReturn denominator of test statistic
WildBootTests.auxweights
— FunctionReturn auxilliary weight matrix for wild bootstrap