Skip to content

Show response level names for clmm models with the emmeans backend - #675

Merged
strengejacke merged 4 commits into
easystats:mainfrom
jmgirard:clmm-response-labels
Oct 13, 2026
Merged

strengejacke merged 4 commits into
easystats:mainfrom
jmgirard:clmm-response-labels

Conversation

@jmgirard

@jmgirard jmgirard commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

For ordinal::clmm models, emmeans codes the response categories as 1, 2, 3 and the thresholds as 1|2, 2|3. So estimate_means(m, backend = "emmeans") showed these codes in the Response and Threshold columns, not the level names. For levels like 2, 4, ..., 10, the codes looked like real levels but were wrong.

.clean_names_emmeans_ordinal() now replaces the codes with model$y.levels, and with <level>|<next level> for thresholds. The threshold names come from the levels, because names(model$alpha) holds parameter names for threshold = "symmetric", "symmetric2" and "equidistant". The mapping runs only for clmm models, and only when the values are exactly the codes. Other models give the same output as before, and a new test checks this for polr, clm and glmmTMB.

test-brms.R:26 fails at random for me. It compares the medians of two sets of posterior draws from the marginaleffects backend, which this PR does not touch. This PR and #673 both bump the version to 0.17.0.10, so the PR that merges second needs a new bump.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

All reviewed changes are covered and no approval-blocking issues were identified.

0 open findings

What changed in this PR

Updates the emmeans backend to show response and threshold names for ordinal::clmm models.

Changes:

  • Maps response and threshold codes to readable level names.
  • Adds ordinal-model regression tests.
  • Documents the fix and bumps the development version.
File Summary
tests/​testthat/​test-ordinal.R Adds comprehensive ordinal-model tests.
R/​get_emmeans.R Converts clmm codes to readable names.
NEWS.md Documents the bug fix.
DESCRIPTION Bumps the development version.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@strengejacke
strengejacke merged commit 6ce72fa into easystats:main Oct 13, 2026
8 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants