Repository navigation
Split response names with dots in contrasts of multivariate brms models - #687
Merged
strengejacke merged 2 commits intoOct 18, 2026
Merged
Conversation
brms removes dots from response names (Sepal.Length becomes SepalLength) and uses these names in the contrast labels, so .split_contrast_response_levels() did not find the response and kept the labels unsplit. It now also searches for the names of insight::find_response(), which hold the brms names.
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 multivariate brms models whose response names contain dots,
estimate_contrasts()did not split the contrast labels intoResponse1/Response2. Formvbind(Sepal.Length, Petal.Length) ~ Specieson iris,estimate_contrasts(m, "Species")returned labels likePetalLength versicolorinLevel1andLevel2.brms removes the dots from the response names (
Sepal.LengthbecomesSepalLength) and uses these names in the labels, but.split_contrast_response_levels()searched only forSepal.Length. The names ofinsight::find_response()hold the brms names, so the fix adds them to the response levels.estimate_means()already shows these names in itsResponsecolumn.The new test in
test-brms.Rfits the iris model above. It fails on main (noResponse1/Response2columns) and passes with the fix: the 15 contrasts haveResponse1levelsSepalLengthandPetalLength, andLevel1/Level2hold only the species.