Fix standard errors for glmmTMB ordinal() models (needs easystats/insight#1221) - #1253
Open
jmgirard wants to merge 2 commits into
Open
Fix standard errors for glmmTMB ordinal() models (needs easystats/insight#1221)#1253jmgirard wants to merge 2 commits into
jmgirard wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Do not merge before easystats/insight#1221. This depends on
insight::get_varcov()returning the delta-method covariance matrix for glmmTMB'sordinal()family, which lands there (henceinsight (>= 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 fromcoef(summary(model))and labels them withfind_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()andmodel_parameters()either errored, or worse, silently recycled the slope SEs over the thresholds (e.g. SE of1|2reported as 0.60 instead of 0.68 onordinal::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 getNA).ci()andp_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, andcompare_parameters(). Tests added intest-glmmTMB-ordinal.R(skipped unless glmmTMB >= 1.1.15 and insight >= 1.5.3.2). Full test suite andR CMD checkclean against the dev insight.