Repository navigation
Conversation
…rcept syntax brms formulas like y ~ 0 + Intercept + x list "Intercept" as a term label, so each VIF was shown under the previous term's name and the last term was dropped. Remove the Intercept pseudo-term from the term labels for brmsfit models. Fixes #417
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The fix is covered by regression tests and all reviewed changes are ready for approval.
0 open findings
What changed in this PR
Fixes incorrect VIF term labels for brms models using 0 + Intercept syntax.
Changes:
- Removes the pseudo-
Interceptterm from labels. - Adds guarded regression coverage for labels and VIFs.
- Updates
NEWS.mdand the development version.
| File | Description |
|---|---|
tests/testthat/test-check_collinearity.R |
Adds regression coverage. |
R/check_collinearity.R |
Corrects brms term-label alignment. |
NEWS.md |
Documents the 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.
This branch has not been deployed
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.
For brms models fit with
y ~ 0 + Intercept + x1 + x2 + ...,check_collinearity()took the term labels fromlabels(terms(formula)), which includesInterceptas a term. The intercept column is already dropped from the covariance matrix and the term assignment, so each VIF was shown under the name of the previous term, anInterceptrow appeared, and the last term was missing. The VIF values themselves were correct.The fix removes the
Interceptpseudo-term from the term labels forbrmsfitmodels. The "Model without intercept" alert from the original report no longer fires, becauseinsight::has_intercept()now recognizes this syntax.A regression test fits the model above (guarded by
skip_on_cran()andskip_if_not_installed("brms"), since it compiles a Stan model). It checks the term labels and compares the VIFs with the ones computed from the slope correlation matrix.Fixes #417