julia> using DataFrames, GLM, CategoricalArrays julia> df= DataFrame(y=[18.,17,15,20,10,20,25,13,12], x1=categorical([1,2,3,1,2,3,1,2,3]), x2=categorical([1,1,1,2,2,2,3,3,3])) 9×3 DataFrame │ Row │ y │ x1 │ x2 │ │ │ Float64 │ Categorical… │ Categorical… │ ├─────┼─────────┼──────────────┼──────────────┤ │ 1 │ 18.0 │ 1 │ 1 │ │ 2 │ 17.0 │ 2 │ 1 │ │ 3 │ 15.0 │ 3 │ 1 │ │ 4 │ 20.0 │ 1 │ 2 │ │ 5 │ 10.0 │ 2 │ 2 │ │ 6 │ 20.0 │ 3 │ 2 │ │ 7 │ 25.0 │ 1 │ 3 │ │ 8 │ 13.0 │ 2 │ 3 │ │ 9 │ 12.0 │ 3 │ 3 │ julia> glm( @formula( y ~ x1 + x2), df, Normal() ) StatsModels.DataFrameRegressionModel{GeneralizedLinearModel{GlmResp{Array{Float64,1},Normal{Float64},IdentityLink},DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2}}}},Array{Float64,2}} Formula: y ~ 1 + x1 + x2 Coefficients: Estimate Std.Error z value Pr(>|z|) (Intercept) 21.0 3.40207 6.17271 <1e-9 x1: 2 -7.66667 3.72678 -2.05718 0.0397 x1: 3 -5.33333 3.72678 -1.43108 0.1524 x2: 2 0.0 3.72678 0.0 1.0000 x2: 3 0.0 3.72678 0.0 1.0000 julia> glm( @formula( y ~ x1 + x2), df, Poisson()) StatsModels.DataFrameRegressionModel{GeneralizedLinearModel{GlmResp{Array{Float64,1},Poisson{Float64},LogLink},DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2}}}},Array{Float64,2}} Formula: y ~ 1 + x1 + x2 Coefficients: Estimate Std.Error z value Pr(>|z|) (Intercept) 3.04452 0.170899 17.8148 <1e-70 x1: 2 -0.454255 0.202171 -2.24689 0.0246 x1: 3 -0.292987 0.192742 -1.5201 0.1285 x2: 2 4.61065e-16 0.2 2.30532e-15 1.0000 x2: 3 3.44687e-17 0.2 1.72344e-16 1.0000 julia> glm( @formula( y ~ x1 + x2), df, NegativeBinomial()) StatsModels.DataFrameRegressionModel{GeneralizedLinearModel{GlmResp{Array{Float64,1},NegativeBinomial{Float64},NegativeBinomialLink},DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2}}}},Array{Float64,2}} Formula: y ~ 1 + x1 + x2 Coefficients: Estimate Std.Error z value Pr(>|z|) (Intercept) -0.04652 0.0106111 -4.3841 <1e-4 x1: 2 -0.0258006 0.0138336 -1.86507 0.0622 x1: 3 -0.0153554 0.012453 -1.23306 0.2176 x2: 2 2.66415e-13 0.0130304 2.04457e-11 1.0000 x2: 3 1.21585e-13 0.0130304 9.33093e-12 1.0000