Skip to content

Use variable labels in glht hypotheses - #1301

Open
M-Colley wants to merge 1 commit into
easystats:mainfrom
M-Colley:fix/glht-variable-labels
Open

M-Colley wants to merge 1 commit into
easystats:mainfrom
M-Colley:fix/glht-variable-labels

Conversation

@M-Colley

Copy link
Copy Markdown

Closes #1139.

Use the fitted model's variable labels when formatting glht() hypotheses. Match the whole coefficient names against those used in the contrast so that descriptive matrix row names and ambiguous duplicate names retain their original text. The Parameter column and numerical results stay the same.

The new test reproduced the missing labels and the truncated interaction label on main. The glht, formatting, and model-label tests passed with the patch. An installed-package check also verified the printed label and equal statistics with label formatting disabled.

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.

🟡 Changes recommended

The package version remains at 0.30.0.19 despite the user-visible change, so installation and update tooling cannot distinguish this release from the previous one.

1 open issue
What changed in this PR

This pull request updates model_parameters() formatting for multcomp::glht objects to use fitted-model variable labels in hypothesis expressions while preserving coefficient names, descriptive contrast labels, and numerical results.

Changes:

  • Added label-aware formatting for coefficient and interaction expressions.
  • Preserved descriptive and ambiguous matrix contrast names.
  • Added regression tests and documented the fix in NEWS.md.
File Description
tests/​testthat/​test-model_parameters.glht.R Adds regression tests for variable labels, interaction labels, disabled formatting, and descriptive matrix contrast names.
R/​format_parameters.R Adds coefficient-aware relabeling of glht hypothesis expressions using fitted-model variable labels.
NEWS.md Documents the glht hypothesis-label formatting fix.

Review effort: Lite

Comment thread NEWS.md
Comment on lines +38 to +39
* `model_parameters()` uses variable labels for coefficients in *multcomp*
hypothesis labels (#1139).

This branch has not been deployed

No deployments
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.

glht objects are not relabeled

2 participants