Closed jariji closed 2 years ago
I have tried but failed to replicate your error message (it all runs smoothly here). Is this in a fresh Julia session? If so, could you show the output of ] status
?
Fresh session:
[bafb0ae5] GLFixedEffectModels v0.4.0 `https://github.com/jmboehm/GLFixedEffectModels.jl.git#master`
[ce6b1742] RDatasets v0.7.7
[ec2bfdc2] Vcov v0.5.2
julia> using GLFixedEffectModels, Vcov, RDatasets
let
df = dataset("datasets", "iris")
df.binary = zeros(Float64, size(df,1))
df[df.SepalLength .> 5.0,:binary] .= 1.0
df.SpeciesStr = string.(df.Species)
idx = rand(1:3,size(df,1),1)
a = ["A","B","C"]
df.Random = vec([a[i] for i in idx])
m = @formula binary ~ SepalWidth + PetalLength + fe(Species)
nlreg(df, m, Binomial(), LogitLink(), Vcov.cluster(:SpeciesStr,:Random) , start = [0.2, 0.2] )
end
ERROR: MethodError: no method matching getindex(::Nothing, ::Int64)
Stacktrace:
[1] S_hat(x::VcovData{LinearAlgebra.Cholesky{Float64, Matrix{Float64}}, 1}, v::Vcov.ClusterCovariance)
@ Vcov ~/.julia/packages/Vcov/uszbF/src/covarianceestimators/vcovcluster.jl:84
[2] vcov(x::VcovData{LinearAlgebra.Cholesky{Float64, Matrix{Float64}}, 1}, v::Vcov.ClusterCovariance)
@ Vcov ~/.julia/packages/Vcov/uszbF/src/covarianceestimators/vcovcluster.jl:115
[3] nlreg(df::Any, formula::FormulaTerm, distribution::Binomial{Float64}, link::LogitLink, vcov::CovarianceEstimator; weights::Union{Nothing, Symbol}, subset::Union{Nothing, AbstractVector}, start::Union{Nothing, AbstractVector}, maxiter_center::Int64, maxiter::Int64, contrasts::Dict{Symbol, Any}, dof_add::Int64, save::Vector{Symbol}, method::Symbol, drop_singletons::Bool, double_precision::Bool, dev_tol::Float64, rho_tol::Float64, step_tol::Float64, center_tol::Float64, separation::Vector{Symbol}, separation_mu_lbound::Float64, separation_mu_ubound::Float64, separation_ReLU_tol::Float64, separation_ReLU_maxiter::Int64, vcovformula::Union{Nothing, Expr, Symbol}, subsetformula::Union{Nothing, Expr, Symbol}, verbose::Bool)
@ GLFixedEffectModels ~/.julia/packages/GLFixedEffectModels/Va8dj/src/fit.jl:526
[4] top-level scope
Yeah, that's the issue. You're using Vcov.jl, which is incompatible with the fact that GLFixedEffectModels exports its own module VCov
. In fact the example from the readme does not do using Vcov
.
It would be desirable to move to Vcov.jl (see #16 ) but I'm not sure when I'll have time to implement this. PR's are welcome.
Closing this as duplicate of #16.
I ran the example from the Readme, using master cf5c96e but I got an error.