Skip to content

Commit

Permalink
More type stabilization; use of SnoopCompile.write to precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
droodman committed Dec 13, 2021
1 parent 883aaf9 commit 5284b9f
Show file tree
Hide file tree
Showing 16 changed files with 597 additions and 418 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ voters.dta
test/profiling.jl
src/WRE2.jl
docs/build/
profile.pb.gz
src/precompiler.jl
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WildBootTests"
uuid = "65c2e505-86ba-4c19-93f1-95506c1443d5"
authors = ["droodman <[email protected]>"]
version = "0.6.2"
version = "0.6.3"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
Empty file added precompiler
Empty file.
80 changes: 80 additions & 0 deletions precompiler.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# run this in a fresh Julia session after having commented out the precompile lines at the bottom of WildBootTests.jl, both to avoid complications and force re-precompile
push!(LOAD_PATH, ".")
using WildBootTests

using SnoopCompileCore
tinf = @snoopi_deep begin
for T in (Float32, Float64)
resp, predexog, clustid = rand(T, 400), rand(T, 400, 4), Int32.(rand(1900:1920, 400))
test = wildboottest(T, [0 0 0 1], [.04]; resp, predexog, clustid, auxwttype=WildBootTests.webb)
teststat(test); p(test); CI(test); plotpoints(test);

test = wildboottest(T, [0 0 0 1], [.04]; resp, predexog, clustid, reps=9999999, auxwttype=WildBootTests.webb, getCI=false)
teststat(test); p(test);

test = wildboottest(T, [0 0 0 1; 0 0 1 0], [0.05; -0.02]; resp, predexog, clustid, reps=9999, auxwttype=WildBootTests.webb)
teststat(test); p(test);

resp, predexog, clustid = rand(T, 2000), rand(T, 2000, 4), Int32.(rand(1:12, 2000))
test = wildboottest(T, [0 1 0 0], [0]; R1=[0 0 1 0], r1=[.2], resp, predexog, clustid)
teststat(test); p(test); CI(test);

resp, predexog, clustid, predendog, inst = rand(T, 2000), rand(T, 2000, 3), Int32.(rand(1:12, 2000)), rand(2000), rand(2000)
test = wildboottest(T, [0 0 0 1], [0]; resp, predexog, predendog, inst, clustid, small=false, reps=9999, ptype=WildBootTests.equaltail)
teststat(test); p(test); CI(test);

test = wildboottest(T, [0 0 0 1], [.0]; resp, predexog, predendog, inst, clustid, small=false, reps=9999, auxwttype=WildBootTests.webb, bootstrapc=true, ptype=WildBootTests.equaltail)
teststat(test); p(test); CI(test);

test = wildboottest(T, [0 0 0 1], [0]; resp, predexog, predendog, inst, clustid, small=false, ARubin=true, reps=9999)
teststat(test); p(test); CI(test);

test = wildboottest(T, [0 0 0 1], [0]; resp, predexog, predendog, inst, clustid, small=false, ARubin=true, reps=9999, imposenull=false)
teststat(test); p(test); CI(test);

test = wildboottest(T, [0 0 0 1], [0]; resp, predexog, predendog, inst, clustid, small=false, reps=0)
teststat(test); p(test); CI(test);

test = wildboottest(T, [0 0 0 1], [0]; resp, predexog, predendog, inst, clustid, small=false, reps=0, imposenull=false)
teststat(test); p(test); CI(test);

resp, predexog, clustid, predendog, inst = rand(T, 2000), rand(T, 2000, 1), Int32.(rand(1:12, 2000)), rand(2000), rand(2000,2)
test = wildboottest(T, [0 1], [0]; resp, predexog, predendog, inst, LIML=true, clustid, small=false, reps=999)
teststat(test); p(test); CI(test);

resp, predexog, clustid, predendog, inst = rand(T, 2000,), rand(T, 2000, 5), Int32.(rand(1:12, 2000)), rand(2000), rand(2000,2)
test = wildboottest(T, [0 0 0 0 0 1], [0]; resp, predexog, predendog, inst, Fuller=1, clustid, small=false, reps=9999, auxwttype=WildBootTests.webb)
teststat(test); p(test); CI(test);

resp, predexog, clustid, obswt, feid = rand(T, 2000,), rand(T, 2000, 3), Int32.(rand(1:12, 2000, 2)), rand(2000), Int64.(rand(1:12,2000))
test = wildboottest(T, [0 0 1], [0]; resp, predexog, clustid, nbootclustvar=1, nerrclustvar=2, obswt, feid)
teststat(test); p(test); CI(test);

resp, predexog, clustid, feid = rand(T, 20000,), rand(T, 20000, 12), Int32.(rand(1:12, 20000, 2)), Int32.(rand(1:12,20000))
test = wildboottest(T, [1 zeros(1,size(predexog,2)-1)], [0]; resp, predexog, clustid, nbootclustvar=1, nerrclustvar=2, feid, reps=9999)
teststat(test); p(test); CI(test);
test = wildboottest(T, [1 zeros(1,size(predexog,2)-1)], [0]; resp, predexog, clustid, nbootclustvar=1, nerrclustvar=2, feid, reps=9999)
teststat(test); p(test); CI(test);
test = wildboottest(T, [1 zeros(1,size(predexog,2)-1)], [0]; resp, predexog, clustid, nbootclustvar=2, nerrclustvar=2, feid, reps=9999)
teststat(test); p(test); CI(test);


resp, predexog, clustid = rand(T, 20000,), rand(T, 20000, 12), Int32.(rand(1:12, 20000, 2))
test = wildboottest(T, [0 1 zeros(1,size(predexog,2)-2)], [0]; resp, predexog, clustid=clustid[:,1], gridpoints=[10], reps=9999)
teststat(test); p(test); CI(test);
test = wildboottest(T, [0 1 zeros(1,size(predexog,2)-2)], [0]; resp, predexog, clustid=clustid[:,1], reps=9999, imposenull=false)
teststat(test); p(test); CI(test);
test = wildboottest(T, [0 1 zeros(1,size(predexog,2)-2)], [0]; resp, predexog, clustid=clustid[:,[2,1]], nbootclustvar=2, nerrclustvar=1, reps=9999)
teststat(test); p(test); CI(test);
test = wildboottest(T, [0 1 zeros(1,size(predexog,2)-2)], [0]; resp, predexog, clustid=clustid[:,[2,1]], nbootclustvar=2, nerrclustvar=1, reps=9999, imposenull=false)
teststat(test); p(test); CI(test);
test = wildboottest(T, [0 1 zeros(1,size(predexog,2)-2)], [0]; resp, predexog, clustid= [collect(1:size(resp,1)) clustid[:,2]], nbootclustvar=1, nerrclustvar=1, reps=9999)
teststat(test); p(test); CI(test);
test = wildboottest(T, [0 1 zeros(1,size(predexog,2)-2)], [0]; resp, predexog, clustid= [collect(1:size(resp,1)) clustid[:,2]], nbootclustvar=1, nerrclustvar=1, reps=9999, imposenull=false)
teststat(test); p(test); CI(test);
end
end

using SnoopCompile
ttot, pcs = SnoopCompile.parcel(tinf);
SnoopCompile.write("/src", [pcs[end]])
49 changes: 37 additions & 12 deletions src/StrBoottest.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Definition of StrBoottest "class" for holding intermediate results, with associated utilities and get functions
# Definition of StrBootTest "class" for holding intermediate results, with associated utilities and get functions

"Auxilliary weight types: `rademacher`, `mammen`, `webb`, `normal`, `gamma`"
@enum AuxWtType rademacher mammen webb normal gamma
Expand All @@ -23,9 +23,35 @@ struct StrFE{T<:Real}
wt::Vector{T}
end

mutable struct StrEstimator{T<:AbstractFloat}
isDGP::Bool; LIML::Bool; Fuller::T; κ::T
R₁perp::Matrix{T}; Rpar::Matrix{T}

@inline vecconvert(T::DataType, X) = isa(X, AbstractArray) ? reshape(eltype(X)==T ? X : T.(X), size(X,1) ) : X
@inline matconvert(T::DataType, X) = isa(X, AbstractArray) ? reshape(eltype(X)==T ? X : T.(X), size(X,1), size(X,2)) : X
kZ::Int64
y₁::Vector{T}; ü₁::Vector{T}; u⃛₁::Vector{T}; β̂::Vector{T}; β̂₀::Vector{T}; invXXXy₁par::Vector{T}
Yendog::Vector{Bool}
invZperpZperp::Symmetric{T,Matrix{T}}; XZ::Matrix{T}; PXZ::Matrix{T}; YPXY::Symmetric{T,Matrix{T}}; R₁invR₁R₁::Matrix{T}
RperpX::#=Uber=#Matrix{T}; RperpXperp::#=Uber=#Matrix{T}; RRpar::Matrix{T}; RparY::#=Uber=#Matrix{T}; RR₁invR₁R₁::Matrix{T}
∂β̂∂r::Matrix{T}; YY::Symmetric{T,Matrix{T}}; AR::Matrix{T}; XAR::Matrix{T}; R₁invR₁R₁Y::Matrix{T}; invXXXZ::Matrix{T}; Ü₂::Matrix{T}; XinvXX::Matrix{T}; Rt₁::Vector{T}
invXX::Symmetric{T,Matrix{T}}; Y₂::Matrix{T}; X₂::Matrix{T}; invH::Symmetric{T,Matrix{T}}
y₁par::Vector{T}; Xy₁par::Vector{T}
A::Symmetric{T,Matrix{T}}; Z::Matrix{T}; Zperp::Matrix{T}; X₁::Matrix{T}
FillingT₀::Matrix{Matrix{T}}
WXAR::Matrix{T}; S⋂PXYZperp::Vector{Matrix{T}}; S⋂YX::Vector{Matrix{T}}; CT_XAR::Vector{Matrix{T}}; CT_FE⋂PY::Vector{Matrix{T}}

# IV/GMM only
ZZ::Symmetric{T,Matrix{T}}; XY₂::Matrix{T}; XX::Symmetric{T,Matrix{T}}; H_2SLS::Symmetric{T,Matrix{T}}; V::Matrix{T}; ZY₂::Matrix{T}; X₂Y₂::Matrix{T}; X₁Y₂::Matrix{T}; ZR₁ZR₁::Symmetric{T,Matrix{T}}; X₂ZR₁::Matrix{T}; ZR₁Y₂::Matrix{T}; X₁ZR₁::Matrix{T}
ZZR₁::Matrix{T}; X₂y₁::Vector{T}; X₁y₁::Vector{T}; Zy₁::Vector{T}; ZXinvXXXZ::Matrix{T}; H_2SLSmZZ::Symmetric{T,Matrix{T}}
ZXinvXXXy₁par::Vector{T}; t₁Y::Vector{T}
Y₂y₁::Vector{T}; twoR₁Zy₁::Vector{T}
y₁y₁::T; y₁pary₁par::T
X₂y₁par::Vector{T}; X₁y₁par::Vector{T}; Zy₁par::Vector{T}
Y₂y₁par::Vector{T}
Rperp::Matrix{T}; ZR₁::Matrix{T}
kX::Int64

StrEstimator{T}(isDGP, LIML, Fuller, κ) where T<:AbstractFloat = new(isDGP, LIML, Fuller, κ, Matrix{T}(undef,0,0))
end

mutable struct StrBootTest{T<:AbstractFloat}
R::Matrix{T}; r::Vector{T}; R₁::Matrix{T}; r₁::Vector{T}
Expand All @@ -34,11 +60,11 @@ mutable struct StrBootTest{T<:AbstractFloat}
LIML::Bool; Fuller::T; κ::T; ARubin::Bool
B::Int64; auxtwtype::AuxWtType; rng::AbstractRNG; maxmatsize::Float16
ptype::PType; null::Bool; bootstrapt::Bool
ID::Matrix{Int64}; nbootclustvar::Int8; nerrclustvar::Int64; issorted::Bool; small::Bool
ID::Matrix{Int64}; nbootclustvar::Int8; nerrclustvar::Int8; issorted::Bool; small::Bool
FEID::Vector{Int64}; FEdfadj::Bool
level::T; rtol::T
madjtype::MAdjType; NH₀::Int16
ML::Bool; β̂::Vector{T}; A::Matrix{T}; sc::Matrix{T}
ML::Bool; β̂::Vector{T}; A::Symmetric{T,Matrix{T}}; sc::Matrix{T}
willplot::Bool; gridmin::Vector{T}; gridmax::Vector{T}; gridpoints::Vector{Float32}

q::Int16; twotailed::Bool; scorebs::Bool; robust::Bool
Expand All @@ -52,14 +78,14 @@ mutable struct StrBootTest{T<:AbstractFloat}
peak::NamedTuple{(:X, :p), Tuple{Vector{T}, T}}

sqrt::Bool; Nobs::Int64; _Nobs::T; kZ::Int64; kY₂::Int64; kX₁::Int64; sumwt::T; NClustVar::Int8; haswt::Bool; REst::Bool; multiplier::T; smallsample::T
WREnonARubin::Bool; dof::Int64; dof_r::Int64; p::T; BootClust::Int8
WREnonARubin::Bool; dof::Int64; dof_r::T; p::T; BootClust::Int8
purerobust::Bool; N✻::Int64; Nw::Int64; enumerate::Bool; interpolable::Bool; interpolate_u::Bool; kX₂::Int64; kX::Int64
_FEID::Vector{Int64}; AR::Matrix{T}; v::Matrix{T}; u✻::Matrix{T}; CT_WE::Matrix{T}
infoBootData::Vector{UnitRange{Int64}}; infoBootAll::Vector{UnitRange{Int64}}; infoErrAll::Vector{UnitRange{Int64}}
JN⋂N✻::Matrix{T}; statDenom::Matrix{T}; uXAR::Matrix{T}; SuwtXA::Matrix{T}; numer₀::Matrix{T}; β̂dev::Matrix{T}; δdenom_b::Matrix{T}
_J⋂::Matrix{T}; YY✻_b::Matrix{T}; YPXY✻_b::Matrix{T}; numerw::Matrix{T}; Zyg::Vector{Matrix{T}}; numer_b::Vector{T}

distCDR::Matrix{T}; plotX::Tuple{Vararg{Vector{T}, N} where N}; plotY::Vector{T}; ClustShare::Vector{T}; WeightGrp::Vector{UnitRange{Int64}}
distCDR::Matrix{T}; plotX::Vector{Vector{T}}; plotY::Vector{T}; ClustShare::Vector{T}; WeightGrp::Vector{UnitRange{Int64}}
numersum::Vector{T}; ü₀::Vector{T}; invFEwt::Vector{T}
β̂s::Matrix{T}; As::Matrix{T}
infoAllData::Vector{UnitRange{Int64}}; info⋂Data::Vector{UnitRange{Int64}}; IDAll::Matrix{T}
Expand All @@ -78,9 +104,9 @@ mutable struct StrBootTest{T<:AbstractFloat}
StrBootTest{T}(R, r, R₁, r₁, y₁, X₁, Y₂, X₂, wt, fweights, LIML,
Fuller, κ, ARubin, B, auxtwtype, rng, maxmatsize, ptype, null, scorebs, bootstrapt, ID, nbootclustvar, nerrclustvar, issorted, robust, small, FEID, FEdfadj, level, rtol, madjtype, NH₀, ML,
β̂, A, sc, willplot, gridmin, gridmax, gridpoints) where T<:Real =
new(matconvert(T,R), vecconvert(T,r), matconvert(T,R₁), vecconvert(T,r₁), vecconvert(T,y₁), matconvert(T,X₁), matconvert(T,Y₂), matconvert(T,X₂), vecconvert(T,wt), fweights, LIML || !iszero(Fuller),
Fuller, κ, ARubin, B, auxtwtype, rng, maxmatsize, ptype, null, bootstrapt, matconvert(Int64,ID), nbootclustvar, nerrclustvar, issorted, small, vecconvert(Int64,FEID), FEdfadj, level, rtol, madjtype, NH₀, ML,
vecconvert(T,β̂), matconvert(T,A), matconvert(T,sc), willplot, gridmin, gridmax, gridpoints,
new(R, r, R₁, r₁, y₁, X₁, Y₂, X₂, wt, fweights, LIML || !iszero(Fuller),
Fuller, κ, ARubin, B, auxtwtype, rng, maxmatsize, ptype, null, bootstrapt, ID, nbootclustvar, nerrclustvar, issorted, small, FEID, FEdfadj, level, rtol, madjtype, NH₀, ML,
β̂, A, sc, willplot, gridmin, gridmax, gridpoints,
nrows(R),
ptype==symmetric || ptype==equaltail,
scorebs || iszero(B) || ML,
Expand All @@ -92,7 +118,6 @@ mutable struct StrBootTest{T<:AbstractFloat}
Vector{T}(undef,0), Vector{T}(undef,0), Matrix{T}(undef,0,0), Vector{T}(undef,0),
Matrix{T}(undef,0,0),
(X = Vector{T}(undef,0), p = T(NaN)))

end


Expand Down Expand Up @@ -334,7 +359,7 @@ function getdf_r(o::StrBootTest)
end
function _getplot(o::StrBootTest)
o.notplotted && plot!(o)
(X=o.plotX, p=o.plotY)
(X=Tuple(o.plotX), p=o.plotY)
end
function getpeak(o::StrBootTest) # x and y values of confidence curve peak (at least in OLS && ARubin)
o.notplotted && plot!(o)
Expand Down
25 changes: 13 additions & 12 deletions src/WRE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ function Filling(o::StrBootTest{T}, ind1::Integer, β̂s::AbstractMatrix) where
PXY✻ = reshape(o.Repl.PXZ[:,ind1], :, 1) # store as matrix to reduce compiler confusion
o.Repl.Yendog[ind1+1] && (PXY✻ = PXY✻ .+ o.S✻UPX[ind1+1] * o.v)

dest = @panelsum(PXY✻ .* (o.Repl.y₁ .- o.S✻UMZperp[1] * o.v), o.wt, o.info⋂Data)
dest = @panelsum(PXY✻ .* (o.Repl.y₁ .- o.S✻UMZperp[1] * o.v), o.info⋂Data)

for ind2 1:o.Repl.kZ
_β̂ = view(β̂s,ind2,:)'
dest .-= @panelsum(PXY✻ .* (o.Repl.Yendog[ind2+1] ? view(o.Repl.Z,:,ind2) * _β̂ .- o.S✻UMZperp[ind2+1] * (o.v .* _β̂) :
(view(o.Repl.Z,:,ind2) * _β̂) ), o.wt, o.info⋂Data)
(view(o.Repl.Z,:,ind2) * _β̂) ), o.info⋂Data)
end
else # create pieces of each N x B matrix one at a time rather than whole thing at once
dest = Matrix{T}(undef, o.clust[1].N, ncols(o.v)) # XXX preallocate this & turn Filling into Filling! ?
Expand All @@ -110,11 +110,11 @@ function Filling(o::StrBootTest{T}, ind1::Integer, β̂s::AbstractMatrix) where
o.Repl.Yendog[ind1+1] && (PXY✻ = PXY✻ .+ view(o.S✻UPX[ind1+1],i,:)'o.v)

if iszero(ind2)
dest[i,:] = wtsum(o.wt, PXY✻ .* (o.Repl.y₁[i] .- view(o.S✻UMZperp[1],i,:))'o.v)
dest[i,:] = colsum(PXY✻ .* (o.Repl.y₁[i] .- view(o.S✻UMZperp[1],i,:))'o.v)
elseif o.Repl.Yendog[ind2+1]
dest[i,:] .-= wtsum(o.wt, PXY✻ .* (o.Repl.Z[i,ind2] * _β̂ .- view(o.S✻UMZperp[ind2+1],i,:)'β̂v))
dest[i,:] .-= colsum(PXY✻ .* (o.Repl.Z[i,ind2] * _β̂ .- view(o.S✻UMZperp[ind2+1],i,:)'β̂v))
else
dest[i,:] .-= wtsum(o.wt, PXY✻ .* (o.Repl.Z[i,ind2] * _β̂))
dest[i,:] .-= colsum(PXY✻ .* (o.Repl.Z[i,ind2] * _β̂))
end
end
else
Expand All @@ -124,9 +124,9 @@ function Filling(o::StrBootTest{T}, ind1::Integer, β̂s::AbstractMatrix) where
reshape(o.Repl.PXZ[S,ind1], :, 1)

if iszero(ind2)
dest[i,:] = wtsum(o.wt, PXY✻ .* (o.Repl.y₁[S] .- view(o.S✻UMZperp[1],S,:) * o.v))
dest[i,:] = colsum(PXY✻ .* (o.Repl.y₁[S] .- view(o.S✻UMZperp[1],S,:) * o.v))
else
dest[i,:] .-= wtsum(o.wt, PXY✻ .* (o.Repl.Yendog[ind2+1] ? o.Repl.Z[S,ind2] * _β̂ .- view(o.S✻UMZperp[ind2+1],S,:) * β̂v :
dest[i,:] .-= colsum(PXY✻ .* (o.Repl.Yendog[ind2+1] ? o.Repl.Z[S,ind2] * _β̂ .- view(o.S✻UMZperp[ind2+1],S,:) * β̂v :
o.Repl.Z[S,ind2] * _β̂ ))
end
end
Expand Down Expand Up @@ -180,7 +180,7 @@ function Filling(o::StrBootTest{T}, ind1::Integer, β̂s::AbstractMatrix) where
if o.Repl.Yendog[ind1+1] && o.Repl.Yendog[ind2+1]
for i 1:o.clust[1].N
S = o.info⋂Data[i]
colquadformminus!(dest, i, cross(view(o.S✻UPX[ind1+1],S,:), o.haswt ? o.wt[S] : zeros(T,0), view(o.S✻UMZperp[ind2+1],S,:)), o.v, β̂v)
colquadformminus!(dest, i, view(o.S✻UPX[ind1+1],S,:)'view(o.S✻UMZperp[ind2+1],S,:), o.v, β̂v)
end
end
end
Expand All @@ -190,12 +190,13 @@ end


function PrepWRE!(o::StrBootTest{T}) where T
EstimateIVGMM!(o.DGP, o.null ? [o.r₁ ; o.r] : o.r₁)
MakeResidualsIVGMM!(o.DGP)
EstimateIV!(o.DGP, o, o.null ? [o.r₁ ; o.r] : o.r₁)
MakeResidualsIV!(o.DGP, o)
Ü₂par = view(o.DGP.Ü₂ * o.Repl.RparY,:,:)

for i 0:o.Repl.kZ # precompute various clusterwise sums
uwt = vHadw(i>0 ? view(Ü₂par,:,i) : view(o.DGP.u⃛₁,:), o.wt)::Union{Vector{T}, SubArray{T, 1}}
u = i>0 ? view(Ü₂par,:,i) : view(o.DGP.u⃛₁,:)
uwt = vHadw(u, o.wt)::Union{Vector{T}, SubArray{T, 1}}

# S_✻(u .* X), S_✻(u .* Zperp) for residuals u for each endog var; store transposed
o.S✻UX[i+1] = @panelsum2(o.Repl.X₁, o.Repl.X₂, uwt, o.infoBootData)'
Expand All @@ -217,7 +218,7 @@ function PrepWRE!(o::StrBootTest{T}) where T
if o.robust && o.bootstrapt
if !o.granular # Within each bootstrap cluster, groupwise sum by all-error-cluster-intersections of u.*X and u.Zperp (and times invXX or invZperpZperp)
for g 1:o.N✻
o.SCT⋂uXinvXX[i+1,g] = @panelsum(o.Repl.XinvXX, uwt, o.infoCT⋂✻[g])
o.SCT⋂uXinvXX[i+1,g] = @panelsum(o.Repl.XinvXX, u, o.infoCT⋂✻[g])
end
end

Expand Down
10 changes: 7 additions & 3 deletions src/WildBootTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export BoottestResult, wildboottest, AuxWtType, PType, MAdjType, DistStatType,
using LinearAlgebra, Random, Distributions, SortingAlgorithms, LoopVectorization

include("utilities.jl")
include("estimators.jl")
include("StrBoottest.jl")
include("estimators.jl")
include("init.jl")
include("WRE.jl")
include("nonWRE.jl")
Expand Down Expand Up @@ -50,7 +50,7 @@ function NoNullUpdate!(o::StrBootTest{T} where T)
if o.WREnonARubin
o.numer[:,1] = o.R * o.DGP.Rpar * o.β̂s[1] - o.r
elseif o.ARubin
EstimateARubin!(o.DGP, o.r)
EstimateARubin!(o.DGP, o, o.r)
o.numer[:,1] = o.v_sd * @view o.DGP.β̂[o.kX₁+1:end,:] # coefficients on excluded instruments in ARubin OLS
else
o.numer[:,1] = o.v_sd * (o.R * (o.ML ? o.β̂ : o.M.β̂) - o.r) # Analytical Wald numerator; if imposing null then numer[:,1] already equals this. If not, then it's 0 before this
Expand Down Expand Up @@ -80,5 +80,9 @@ function UpdateBootstrapcDenom!(o::StrBootTest{T} where T, w::Integer)
nothing
end

include("precompile.jl")
if Base.VERSION >= v"1.4.2" # source: https://timholy.github.io/SnoopCompile.jl/stable/snoopi_deep_parcel/#SnoopCompile.write
include("../src/precompile_WildBootTests.jl")
_precompile_()
end

end
Loading

2 comments on commit 5284b9f

@droodman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/50421

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.3 -m "<description of version>" 5284b9f67b69929bdafb51489c9bb2bd7ac3aa17
git push origin v0.6.3

Please sign in to comment.