# Conditional logit (clogit) in Julia?

**URL:** https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215
**Category:** Statistics
**Created:** [July 7, 2021, 2:17pm UTC](https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215 "2021-07-07T14:17:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [July 7, 2021, 2:17pm UTC](https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215/1 "2021-07-07T14:17:28Z")

</div>

Given it isn’t at all my subject, a colleague of mine interested in Julia asked if there is a Julia package that implements the “conditional logit” model, similar to the `clogit` function in R `survival` package.

Having browsed the subject a bit, it seems that the conditional logit is “equivalent” (??) to a “Cox model with a particular structure” and that Cox models are implemented in the [fit(::Type{CoxModel},…)](https://juliastats.org/Survival.jl/latest/cox/#Cox-Proportional-Hazards-Model-1) function of the `Survival.jl` package.

Is that right? Can the `fit` function of that package be used for a conditional logit model ? Is it straight-forward ? Does anyone already did and can share some simple code I can show to my colleague ?  
Thanks !

---

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [January 10, 2023, 3:43pm UTC](https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215/2 "2023-01-10T15:43:53Z")

</div>

he is still asking 😉  
A new PhD student would like to try using Julia but my colleague (that will be his supervisor) says that there isn’t nothing about this in Julia… is this still true?  
They will work on choice modelling, perhaps [GitHub - mattwigway/DiscreteChoiceModels.jl: Discrete choice/random utility models in Julia](https://github.com/mattwigway/DiscreteChoiceModels.jl) will be relevant ?

---

<div class="post-metadata">

### Author: ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)
#### Post date: [January 10, 2023, 5:20pm UTC](https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215/3 "2023-01-10T17:20:28Z")

</div>

There may be specific code available from someone, though I am not aware of any. This model is easy to program, I did it long ago using the Gauss language 🙄 I have some generic MLE code at [Econometrics/src/ML at main · mcreel/Econometrics · GitHub](https://github.com/mcreel/Econometrics/tree/main/src/ML). If one were to write the conditional logit likelihood function using the form in the examples in the Likelihoods subdirectory, that would work.

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [January 10, 2023, 5:28pm UTC](https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215/4 "2023-01-10T17:28:34Z")

</div>

Maybe @nosferican?

---

<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: [January 10, 2023, 5:39pm UTC](https://discourse.julialang.org/t/conditional-logit-clogit-in-julia/64215/5 "2023-01-10T17:39:20Z")

</div>

I suspect having seen it in the ecosystem. A quick search led me to [GitHub - alancrawford/GEV.jl: Estimate Generalized Extreme Value Models](https://github.com/alancrawford/GEV.jl) It may be worth just checking a couple examples from the R package and seeing if the functionality is suitable for their purpose.
