# Logistic regression with GLM : not working with Categorical Arrays?

**URL:** https://discourse.julialang.org/t/logistic-regression-with-glm-not-working-with-categorical-arrays/14411
**Category:** Statistics
**Tags:** first-steps, glm
**Created:** [September 1, 2018, 4:13pm UTC](https://discourse.julialang.org/t/logistic-regression-with-glm-not-working-with-categorical-arrays/14411 "2018-09-01T16:13:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kirtsar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirtsar/32/7222_2.png) [@kirtsar](https://discourse.julialang.org/u/kirtsar)
#### Post date: [September 1, 2018, 4:13pm UTC](https://discourse.julialang.org/t/logistic-regression-with-glm-not-working-with-categorical-arrays/14411/1 "2018-09-01T16:13:05Z")

</div>

Hello there!  
I’m trying to do logistic regression using GLM Package. My Y-variable is of type categorical array, the predictor is the usual Float64-array. When I’m trying to make a model with @formula(Y ~ X), I’ve got a mistake: MethodError: no method matching zero(::Type{CategoricalValue{Int64,UInt8}})  
So is it possible to make logregr work without manual encoding of categorical array?

---

<div class="post-metadata">

### Author: ![Nosferican](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nosferican/32/9275_2.png) [@Nosferican](https://discourse.julialang.org/u/Nosferican)
#### Post date: [September 2, 2018, 3:08am UTC](https://discourse.julialang.org/t/logistic-regression-with-glm-not-working-with-categorical-arrays/14411/2 "2018-09-02T03:08:49Z")

</div>

See [GLM.jl/issues/240](https://github.com/JuliaStats/GLM.jl/issues/240).  
For a quick regression you could use a draft I have at [Econometrics.jl](https://github.com/JuliaEconometrics/Econometrics.jl) (I still need to port a few things to it that I have in other packages, but the code there does it).
