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

negbin fails on X, y data #455

Open
awadell1 opened this issue Nov 11, 2021 · 1 comment
Open

negbin fails on X, y data #455

awadell1 opened this issue Nov 11, 2021 · 1 comment

Comments

@awadell1
Copy link

Per the doc string: negbin(X::AbstractMatrix, y::AbstractVector, [link::Link]; <keyword arguments>) is valid however:

julia> using GLM

julia> m = negbin(ones(100,1), Int.(rand(UInt32, 100)))
ERROR: type GeneralizedLinearModel has no field model
Stacktrace:
 [1] getproperty(x::GeneralizedLinearModel{GLM.GlmResp{Vector{Float64}, Poisson{Float64}, LogLink}, GLM.DensePredChol{Float64, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}}, f::Symbol)
   @ Base ./Base.jl:33
 [2] negbin(::Matrix{Float64}, ::Vector{Int64}; initialθ::Float64, maxiter::Int64, minstepfac::Float64, atol::Float64, rtol::Float64, verbose::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ GLM ~/.julia/packages/GLM/5CcRd/src/negbinfit.jl:112
 [3] negbin(::Matrix{Float64}, ::Vector{Int64})
   @ GLM ~/.julia/packages/GLM/5CcRd/src/negbinfit.jl:78
 [4] top-level scope
   @ REPL[118]:1

Issue seems to stem from negbin assuming that regmodel (Defined at Ln 105/108 in negbinfit.jl ) is a TableRegressionModel and not a GLMResp

@nalimilan
Copy link
Member

Good catch. We should indeed check the type of regmodel via something like model = regmodel isa TableRegressionModel ? regmodel.model ? model and then use only model. PR welcome.

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