Skip to content

Fix standard errors for glmmTMB ordinal() models (needs easystats/insight#1221) - #1253

Open
jmgirard wants to merge 2 commits into
mainfrom
glmmtmb-ordinal
Open

Fix standard errors for glmmTMB ordinal() models (needs easystats/insight#1221)#1253
jmgirard wants to merge 2 commits into
mainfrom
glmmtmb-ordinal

Conversation

@jmgirard

@jmgirard jmgirard commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

Do not merge before easystats/insight#1221. This depends on insight::get_varcov() returning the delta-method covariance matrix for glmmTMB's ordinal() family, which lands there (hence insight (>= 1.5.3.2) in DESCRIPTION). CI will fail until r-universe rebuilds insight.

Companion to easystats/insight#1221 for the new ordinal() family in glmmTMB (>= 1.1.15).

.se_fixed_effects_glmmTMB() reads standard errors from coef(summary(model)) and labels them with find_parameters(). For ordinal fits the thresholds are not in the summary table (they are family parameters estimated on an internal softmax scale), so the two vectors differ in length: standard_error() and model_parameters() either errored, or worse, silently recycled the slope SEs over the thresholds (e.g. SE of 1|2 reported as 0.60 instead of 0.68 on ordinal::wine).

This PR takes the SEs for ordinal fits from insight::get_varcov() instead, which returns them on the threshold scale via the delta method and aligned by parameter name (non-estimated parameters get NA). ci() and p_value() were already routed through insight and unaffected.

Verified against ordinal::clm()/clmm(): model_parameters() now matches column for column (Coefficient, SE, CI, z, p), including probit link, exponentiate, ci_method = "profile", bootstrap = TRUE, standardize = "refit", rank-deficient fits, and compare_parameters(). Tests added in test-glmmTMB-ordinal.R (skipped unless glmmTMB >= 1.1.15 and insight >= 1.5.3.2). Full test suite and R CMD check clean against the dev insight.

The thresholds of glmmTMB's ordinal family are not part of the summary
coefficient table, so .se_fixed_effects_glmmTMB() silently recycled the
slope SEs over the thresholds (or errored when the lengths were not
multiples). Standard errors are now taken from insight::get_varcov(),
which returns them on the threshold scale via the delta method.
insight 1.5.4 was released to CRAN without the ordinal support, so the
previous floor (1.5.3.2) no longer enforces easystats/insight#1221.
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.

1 participant