pymc-devs / pymc-devs/pymc-examples

Analysing ordinal data in PyMC

Open
#277 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal
Dominant language
Python
Stars
398
Forks
325
Avg merge
9d 15m
Merged PRs (30d)
1

Description

Notebook proposal

Title: Analysing ordinal data in PyMC

Why should this notebook be added to pymc-examples?

Ordinal outcome variables are common in many data analysis situations. Example measures include:

  • BMI: underweight, normal, overweight, obese
  • Likert scale data, eg. strongly agree, agree, neutral, disagree, strongly disagree.

Often people can be lazy in their analysis of ordinal data, and fall back to treating it as continuous.

The goal of this example is to demonstrate current best practice for ordinal regression in PyMC. In particular, it will make use of the new pm.OrderedProbit and pm.OrderedLogit distributions. Once #5418 is merged, then we can go ahead with an example notebook.

The plan is to put it in the GLM section. Current rough outline would be something like:

  • What is ordinal data?
  • Why is it crucial to analyse it properly?
  • Priors over cutpoints: This could be an involved topic, but long story short is that some constraints on the cutpoint parameters are needed (see Discussion #5055). It will probably use my proposed ConstrainedUniform distribution (see https://github.com/pymc-devs/pymcx/issues/32). We can always circle back and update this if a more polished solution presents itself.
  • Testing for group differences. E.g. response ~ group are useful for testing for differences in response distributions between groups
  • When you have a continuous predictor. E.g. response ~ continuous_predictor
  • Maybe include the combination, response ~ continuous_predictor + group if the notebook is not getting bloated, and if it seems necessary.

Related notebooks

As far as I understand there are no existing notebooks which provide examples for the analysis of ordinal data. The closest I can find is an old PyMC port of Chapter 23 of Kruschke, but that's totally independent of pymc-examples.

References

  • Liddell, T. M. & Kruschke, J. K. Analyzing ordinal data with metric models: What could possibly go wrong? J Exp Soc Psychol 79, 328–348 (2018).
  • Bürkner, P.-C. & Vuorre, M. Ordinal Regression Models in Psychology: A Tutorial. Advances in Methods and Practices in Psychological Science 42, 251524591882319–25 (2019).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the GLM section and the related notebook material, then compare the proposed analyses with the referenced ordinal-regression literature and the OrderedProbit and OrderedLogit APIs. Done means adding a notebook that covers the stated ordinal-data concepts, priors, group and continuous predictors, with scope kept within the planned outline.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.