Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The change still has an unbumped development version and an avoidable full posterior allocation that can cause substantial performance and memory problems.
2 open issues
1 file not reviewed
man/estimate_grouplevel.Rd: Generated file
What changed in this PR
Updates estimate_grouplevel(type = "total") for brms models to retain only coefficients with corresponding varying effects.
Changes:
- Filters fixed-only brms coefficients by group and model component.
- Adds regression coverage for nonlinear, varying-slope, and zero-inflation models.
- Updates documentation, NEWS, and affected plot snapshots.
| File | Description |
|---|---|
| tests/testthat/test-estimate_grouplevel.R | Adds regression tests covering brms group-level total coefficient filtering. |
| tests/testthat/_snaps/windows/plot-grouplevel/plot-grouplevel-bayes-5.svg | Updates the Windows expected plot snapshot for the revised group-level output. |
| tests/testthat/_snaps/windows/plot-grouplevel/plot-grouplevel-bayes-4.svg | Updates the Windows expected plot snapshot for the revised group-level output. |
| tests/testthat/_snaps/linux/plot-grouplevel/plot-grouplevel-bayes-5.svg | Updates the Linux expected plot snapshot for the revised group-level output. |
| tests/testthat/_snaps/linux/plot-grouplevel/plot-grouplevel-bayes-4.svg | Updates the Linux expected plot snapshot for the revised group-level output. |
| R/estimate_grouplevel.R | Filters brms total estimates to coefficients with corresponding varying effects. |
| NEWS.md | Documents the brms group-level total estimate behavior change. |
| man/estimate_grouplevel.Rd | Updates the generated documentation for group-level estimate behavior. |
Review effort: Lite
|
|
||
| if (type == "total") { | ||
| # brms::coef() repeats fixed-only coefficients for each grouping factor. | ||
| random_terms <- lapply(brms::ranef(model, summary = FALSE), function(x) dimnames(x)[[3L]]) |
Comment on lines
+14
to
+15
| * `estimate_grouplevel(type = "total")` now excludes brms coefficients without | ||
| a random effect in the corresponding group and model component. |
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.


Summary
Keep
estimate_grouplevel(type = "total")rows for brms coefficients that vary in the corresponding group and model component. In the chocomini example, this removes the 20 copies of the fixed-only precision coefficient. The 60 varying coefficients retain their estimates.Fixes #467.
Validation
mainand passed with the patch. The examples cover a nonlinear model, groups with different slopes, and a zero-inflation model.I used Codex to prepare and test this patch.