We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Per the doc strings for lrtest:
lrtest
julia> using DataFrames, GLM julia> dat = DataFrame(Result=[1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1], Treatment=[1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2], Other=categorical([1, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1])); julia> nullmodel = glm(@formula(Result ~ 1), dat, Binomial(), LogitLink()); julia> model = glm(@formula(Result ~ 1 + Treatment), dat, Binomial(), LogitLink()); julia> bigmodel = glm(@formula(Result ~ 1 + Treatment + Other), dat, Binomial(), LogitLink()); julia> lrtest(nullmodel, model, bigmodel) Likelihood-ratio test: 3 models fitted on 12 observations ────────────────────────────────────────────── DOF ΔDOF Deviance ΔDeviance p(>Chisq) ────────────────────────────────────────────── [1] 1 16.3006 [2] 2 1 15.9559 -0.3447 0.5571 [3] 4 2 14.0571 -1.8988 0.3870 ────────────────────────────────────────────── julia> lrtest(bigmodel, model, nullmodel) Likelihood-ratio test: 3 models fitted on 12 observations ────────────────────────────────────────────── DOF ΔDOF Deviance ΔDeviance p(>Chisq) ────────────────────────────────────────────── [1] 4 14.0571 [2] 2 -2 15.9559 1.8988 0.3870 [3] 1 -1 16.3006 0.3447 0.5571 ──────────────────────────────────────────────
However, categorical is not defined (Shows up in doctests too: https://github.com/JuliaStats/StatsModels.jl/runs/4027286993?check_suite_focus=true#step:4:2433). Adding a using CategoricalArrays also errors with:
categorical
using CategoricalArrays
julia> using DataFrames, GLM, CategoricalArrays julia> dat = DataFrame(Result=[1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1], Treatment=[1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2], Other=categorical([1, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1])); julia> nullmodel = glm(@formula(Result ~ 1), dat, Binomial(), LogitLink()); julia> model = glm(@formula(Result ~ 1 + Treatment), dat, Binomial(), LogitLink()); julia> bigmodel = glm(@formula(Result ~ 1 + Treatment + Other), dat, Binomial(), LogitLink()); julia> lrtest(nullmodel, model, bigmodel) ERROR: MethodError: no method matching isnested(::GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, ::GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}; atol=0.0) Stacktrace: [1] isnested(m1::StatsModels.TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, Matrix{Float64}}, m2::StatsModels.TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, Matrix{Float64}}; kwargs::Base.Iterators.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:atol,), Tuple{Float64}}}) @ StatsModels ~/.julia/packages/StatsModels/m1jYD/src/statsmodel.jl:147 [2] lrtest(::StatsModels.TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, Matrix{Float64}}, ::Vararg{StatsModels.TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, Matrix{Float64}}, N} where N; atol::Float64) @ StatsModels ~/.julia/packages/StatsModels/m1jYD/src/lrtest.jl:90 [3] lrtest(::StatsModels.TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, Matrix{Float64}}, ::Vararg{StatsModels.TableRegressionModel{GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Binomial{Float64}, LogitLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, Matrix{Float64}}, N} where N) @ StatsModels ~/.julia/packages/StatsModels/m1jYD/src/lrtest.jl:74 [4] top-level scope @ REPL[84]:1
The text was updated successfully, but these errors were encountered:
dat = DataFrame(Result=[1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1], Treatment=[1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2], Other=string.([1, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1]));
works.
Sorry, something went wrong.
fix docstring for lrtest
d6d592f
changing `categorical` to `string.` fixes issue JuliaStats#250
fix docstring for lrtest (#259)
142e02f
changing `categorical` to `string.` fixes issue #250
closed by #259
No branches or pull requests
Per the doc strings for
lrtest
:However,
categorical
is not defined (Shows up in doctests too: https://github.com/JuliaStats/StatsModels.jl/runs/4027286993?check_suite_focus=true#step:4:2433). Adding ausing CategoricalArrays
also errors with:The text was updated successfully, but these errors were encountered: