Skip to content

WIP ENH: add Ordinal Logit and Probit - OrderedModel - #2600

Closed
josef-pkt wants to merge 2 commits into
statsmodels:masterfrom
josef-pkt:ordinal
Closed

josef-pkt wants to merge 2 commits into
statsmodels:masterfrom
josef-pkt:ordinal

Conversation

@josef-pkt

@josef-pkt josef-pkt commented Aug 24, 2015 •

Copy link
Copy Markdown
Member

see issue #807

Ordered or ordinal cumulative link models

Initial version

params table looks correct compared to a UCLA Stata example.

lot of things still TODO, but GenericLikelihoodModel works mostly pretty well

no unit tests yet

@jbwhit

jbwhit commented Oct 16, 2015

Copy link
Copy Markdown

I just wanted to leave a comment in support of adding this feature.

@Michael-E-Rose

Copy link
Copy Markdown

About a year later: This model is really necessary for Econometricians. I support adding this feature!

@robinkramer2

Copy link
Copy Markdown

What is the current stance of this function? Have there been any improvements yet?

@josef-pkt

Copy link
Copy Markdown
Member Author

@jbrockmendel

Copy link
Copy Markdown
Contributor

Is this... what is this? I noticed discrete_model has an OrderedModel and OrderedResults that appear to be placeholders. Kind of expected this to fill in those blanks, but...

@christian-oreilly

Copy link
Copy Markdown

What is the status of this PR? How much work do you think is still needed to integrate it? May I contribute to get it moving forward?

@bashtage

Copy link
Copy Markdown
Member

By appearances, it is far from finished.

  • No results class
  • No tests
  • ?? Correctness/Completeness

It would be great if you want to pick this up. You could add @josef-pkt 's repo as a remote, then clone his branch, which keeps the full history. I would then rebase on master for safety. You could then try to see if it (a) works (b) produces reasonable estimates.

@josef-pkt

josef-pkt commented Jun 14, 2019 •

Copy link
Copy Markdown
Member Author

based on what I remember

The model works/worked and produces the correct result in the examples.
The specification of the constant/threshold varies across packages, and I don't remember whether I used the same as Stata (I think not)

The model uses the generic framework and doesn't have any model specific extras.
Model and Results classes are based on GenericLikelihoodModel which is also the reason that the module is in miscmodels.

There is no support for pandas.Categorical. At the time it was just recently added to pandas and not yet stable. pandas Categorical has the advantage that it includes ordered categoricals.
Without that, the ordering of levels needs to be in numbers (integers) are alphanumeric, AFAIR.

I thought I had some test cases, but it looks like I only used them as examples. Unit tests against R or Stata are missing.

Basing the model on the GenericLikelihood setup provides all the main results, but misses model specific results and does not use model specific computational shortcuts, e.g. score and Hessian.

@josef-pkt

Copy link
Copy Markdown
Member Author

The specification of the constant/threshold varies across packages

They define the same model and there is a one-to-one mapping for different specifications of the parameters. The version that I used has exponentiated increments in the threshold to impose monotonicity in thresholds (or equivalently category level specific intercepts)

Also, in 2015 when I wrote this, I wrote a lot of generic code for various general classes of models.
The approach here is very similar to an interval censored model, and can be extended to arbitrary distributions for the latent variable besides the currently included normal/Probit and logistic/Logit.

@leavor

leavor commented Aug 9, 2019

Copy link
Copy Markdown

The specification of the constant/threshold varies across packages

They define the same model and there is a one-to-one mapping for different specifications of the parameters. The version that I used has exponentiated increments in the threshold to impose monotonicity in thresholds (or equivalently category level specific intercepts)

Also, in 2015 when I wrote this, I wrote a lot of generic code for various general classes of models.
The approach here is very similar to an interval censored model, and can be extended to arbitrary distributions for the latent variable besides the currently included normal/Probit and logistic/Logit.

Hi,@josef-pkt
I use OrderedModel for ordinal logistic regression, encountered a 'NotImplementedError' bug.
The statsmodels vesion = 0.10.0.
I have used sm.GLM for Binary Logistic regression and Poisson regression, which works well.
How can I use OrderedModel correctly for ordinal logistic regression?
Thanks very much.
See details #6084

@josef-pkt

Copy link
Copy Markdown
Member Author

continuation in #6982
version merged #7035

follow-up issue #7069

@josef-pkt josef-pkt closed this Oct 8, 2020
@josef-pkt
josef-pkt deleted the ordinal branch February 21, 2021 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants