Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in 31 bootstrap / jk = true with version 0.8.3 #15

Closed
s3alfisc opened this issue Dec 17, 2022 · 2 comments
Closed

Bug in 31 bootstrap / jk = true with version 0.8.3 #15

s3alfisc opened this issue Dec 17, 2022 · 2 comments

Comments

@s3alfisc
Copy link
Contributor

Hi David,

Some of fwildclusterboot's unit tests are failing after the update of WildBootTests.jl to 0.8.3. The problem seems to arise when setting jk = true.

Here is a reproducible example:

using WildBootTests, CSV, DataFrames, StatsModels, GLM

d = download("https://raw.github.com/vincentarelbundock/Rdatasets/master/csv/sandwich/PetersenCL.csv");
df = CSV.read(d, DataFrame);
f = @formula(y ~ 1 + x);  # state OLS model
f = apply_schema(f, schema(f, df));  # link model to data
resp, predexog = modelcols(f, df);  
clustid = df.firm
R = [0 1]; r = [1]; 

test = wildboottest(R, r; resp=resp, predexog=predexog, clustid=clustid, jk = true)

julia> test= wildboottest(R, r; resp = resp, predexog = predexog, clustid = clustid, jk = true)
ERROR: TypeError: in typeassert, expected Array{Float64, 3}, got a value of type Vector{SubArray{Float64, 2, Array{Float64, 3}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64, Base.Slice{Base.OneTo{Int64}}}, false}}
Stacktrace:
  [1] -
    @ C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\utilities.jl:688 [inlined]
  [2] InitVarsOLS!(o::WildBootTests.StrEstimator{Float64}, parent::WildBootTests.StrBootTest{Float64}, Rperp::Matrix{Float64})
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\estimators.jl:83
  [3] Init!(o::WildBootTests.StrBootTest{Float64})
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\init.jl:203
  [4] boottestOLSARubin!(o::WildBootTests.StrBootTest{Float64})
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\WildBootTests.jl:18
  [5] plot!(o::WildBootTests.StrBootTest{Float64})
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\plot-CI.jl:48
  [6] __wildboottest(R::Matrix{Float64}, r::Vector{Float64}; resp::Vector{Float64}, predexog::Matrix{Float64}, predendog::Matrix{Float64}, inst::Matrix{Float64}, R1::Matrix{Float64}, r1::Vector{Float64}, clustid::Matrix{Int64}, nbootclustvar::Int64, nerrclustvar::Int64, issorted::Bool, hetrobust::Bool, nfe::Int64, feid::Vector{Int64}, fedfadj::Int64, obswt::Vector{Float64}, fweights::Bool, maxmatsize::Float16, ptype::Symbol, bootstrapc::Bool, liml::Bool, fuller::Float64, kappa::Float64, arubin::Bool, small::Bool, clusteradj::Bool, clustermin::Bool, jk::Bool, scorebs::Bool, reps::Int64, imposenull::Bool, auxwttype::Symbol, rng::Random.MersenneTwister, level::Float64, rtol::Float64, madjtype::Symbol, nH0::Int16, ml::Bool, scores::Matrix{Float64}, beta::Vector{Float64}, A::LinearAlgebra.Symmetric{Float64, Matrix{Float64}}, gridmin::Vector{Float64}, gridmax::Vector{Float64}, gridpoints::Vector{Float64}, diststat::Symbol, getci::Bool, getplot::Bool, getauxweights::Bool)
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\interface.jl:141
  [7] _wildboottest(T::DataType, R::Matrix{Int64}, r::Vector{Int64}; resp::Vector{Float64}, predexog::Matrix{Float64}, predendog::Matrix{Float64}, inst::Matrix{Float64}, R1::Matrix{Float64}, r1::Vector{Float64}, hetrobust::Bool, clustid::Vector{Int64}, nbootclustvar::Int64, nerrclustvar::Int64, issorted::Bool, nfe::Int64, feid::Vector{Int8}, fedfadj::Int64, obswt::Vector{Float64}, fweights::Bool, maxmatsize::Int64, ptype::Symbol, bootstrapc::Bool, liml::Bool, fuller::Int64, kappa::Float64, arubin::Bool, small::Bool, clusteradj::Bool, clustermin::Bool, jk::Bool, scorebs::Bool, reps::Int64, imposenull::Bool, auxwttype::Symbol, rng::Random.MersenneTwister, level::Float64, rtol::Float64, madjtype::Symbol, nH0::Int64, ml::Bool, scores::Matrix{Float32}, beta::Vector{Float64}, A::Matrix{Float64}, gridmin::Vector{Float64}, gridmax::Vector{Float64}, gridpoints::Vector{Int64}, diststat::Symbol, getci::Bool, getplot::Bool, getauxweights::Bool)
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\interface.jl:269
  [8] #_wildboottest#166
    @ C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\interface.jl:323 [inlined]
  [9] wildboottest(R::Matrix{Int64}, r::Vector{Int64}; kwargs::Base.Pairs{Symbol, Any, NTuple{4, Symbol}, NamedTuple{(:resp, :predexog, :clustid, :jk), Tuple{Vector{Float64}, Matrix{Float64}, Vector{Int64}, Bool}}})
    @ WildBootTests C:\Users\alexa\.julia\packages\WildBootTests\UYtC2\src\interface.jl:402
 [10] top-level scope
    @ REPL[23]:1
@droodman
Copy link
Owner

Sorry about that. Want to try version 0.8.4?

@s3alfisc
Copy link
Contributor Author

Thanks - all tests pass again =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants