Repository navigation
Fix standardize() on stan_lmer() models - #746
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A moderate active finding remains because the test mutates and unconditionally removes a pre-existing global stan_glmer binding, risking shared test-state corruption.
1 open issue
What changed in this PR
Fixes standardize() dispatch for rstanarm::stan_lmer() models by routing stanreg objects through the default standardization path instead of the incompatible lmerMod implementation.
Changes:
- Adds
standardize.stanregas an alias ofstandardize.default(). - Registers the new S3 method in
NAMESPACE. - Adds regression coverage for standardized
stan_lmer()response and predictor data.
This pull request requires changes.
| File | Summary |
|---|---|
tests/testthat/test-standardize_models.R |
Adds stan_lmer() regression coverage. Moderate finding (2 votes): the test overwrites and unconditionally removes any pre-existing stan_glmer binding in the global environment; it should save and restore the original state or avoid mutating globalenv(). |
R/standardize.models.R |
Routes stanreg models through the compatible default standardization implementation. |
NAMESPACE |
Registers the standardize.stanreg S3 method. |
Review effort: Lite
Contributor
Author
|
Copilot's review was right that the test overwrote and then deleted any |
Closed
Merged
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.

standardize.lmerMod()from #716 also catchesstan_lmer()models, because their class vector ends inlmerMod. Its helper then readsmodel@frame, which fails on astanregobject, sostandardize()stops with "Unable to refit the model with standardized data." 1.4.1 works, and the error also failstest-report_performance.Rin report.stanregmodels now go tostandardize.default()again. No release has this bug, so there's noNEWS.mdbullet.