JuliaStats / GLM.jl

Generalized linear models in Julia
Other
584 stars 114 forks source link

add custom summary to types in GLM.jl #469

Open bkamins opened 2 years ago

bkamins commented 2 years ago

Example:

julia> model = lm(@formula(y ~ x), dataset)
StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{Vector{Float64}},
 GLM.DensePredChol{Float64, LinearAlgebra.CholeskyPivoted{Float64,
 Matrix{Float64}}}}, Matrix{Float64}}

y ~ 1 + x

Coefficients:
───────────────────────────────────────────────────────────────────────
                Coef.  Std. Error     t  Pr(>|t|)  Lower 95%  Upper 95%
───────────────────────────────────────────────────────────────────────
(Intercept)  3.00009     1.12475   2.67    0.0257   0.455737   5.54444
x            0.500091    0.117906  4.24    0.0022   0.23337    0.766812
───────────────────────────────────────────────────────────────────────

Users are overwhelmed and confused about the meaning of

StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{Vector{Float64}},
 GLM.DensePredChol{Float64, LinearAlgebra.CholeskyPivoted{Float64,
 Matrix{Float64}}}}, Matrix{Float64}}

part.

I am not sure what naming convention would be best as I do not know the exact type hierarchy in StatsModels.jl and GLM.jl, but maybe just omitting printing type parameters would be enough?

nalimilan commented 2 years ago

Yes, we could probably just print TableRegressionModel{LinearModel}. And the day we get rid of TableRegressionModel this will just be LinearModel.

For GLMs, it would be useful to print something like TableRegressionModel{GeneralizedLinearModel} with Binomial family and ProbitLink.

bkamins commented 2 years ago

@nalimilan - do you know the type hierarchy well enough to make this PR easily (I can look into it but I would need to learn GLM.jl and StatsModels.jl internals 😄)?