Repository navigation
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
This PR fixes argument forwarding in check_model() methods that wrap/convert models so that check_model.default() can correctly apply its own defaults for type and detrend, and so user-specified size_title is preserved.
Changes:
- Pass
NULLfortype/detrendfrom wrapper methods when the user didn’t supply them, and interpretNULLlike “missing” incheck_model.default(). - Ensure
size_titleis forwarded through wrappers (stanreg,model_fit, and simulated residual objects). - Add regression tests + NEWS entry; bump development version and update WORDLIST.
| File | Description |
|---|---|
R/check_model.R |
Treat NULL like missing for type/detrend, forward size_title, adjust Stan fallback handling. |
tests/testthat/test-check_model.R |
Add regression tests for forwarding/default behavior across wrapped/converted model types. |
NEWS.md |
Document behavior change for defaults and size_title forwarding. |
inst/WORDLIST |
Add parsnip to spell-check allowlist. |
DESCRIPTION |
Bump package version. |
Review effort: Lite
|
Related, but not changed here: with bayestestR 0.19.0, which the current minimum allows, |
|
Yes, we can do that. I just didn't want to increase version requirement for the recent performance submission because bayestestR was just released on CRAN, and sometimes, it is good to allow users some time to manage their software and package updates :-) |
|
Is there anything we need to change now that we set the minimum requirement to 0.20.0 for bayestestR?, Else, you can merge this PR |


Three methods call
check_model()again on the inner model:check_model.stanreg()(also used for brms),check_model.model_fit()(parsnip), andcheck_model.performance_simres()(also used for DHARMa). They passedtype = typeanddetrend = detrendwith their own defaults. Somissing(type)andmissing(detrend)were alwaysFALSEincheck_model.default(), and its defaults never applied. They also did not passsize_title, so a user value was dropped.For example,
check_model(glm(am ~ wt, data = mtcars, family = binomial))usestype = "discrete_interval"anddetrend = FALSE. Butcheck_model(simulate_residuals(<same glm>))used"density"andTRUE. Thedetrendhelp already says simulated residuals are not detrended by default.What changes
typeordetrend, the three methods passNULL, andcheck_model.default()treatsNULLlike a missing argument. They now passsize_title.NULLtypeits default. It turns aNULLdetrendintoTRUE, the value a direct call gives, so the result keeps a logicaldetrend.parsnipadded toinst/WORDLIST, and the dev version is bumped.Tests
simulate_residuals()of a binomial and a poisson glm andDHARMa::simulateResiduals()get"discrete_interval"and the defaultdetrend. So do amodel_fitobject and thestanreg_glm_1fixture, also inside amodel_fit. The user'stype,detrend, andsize_titlevalues are kept.lmkeeps"density"andtitle_size12. A wrapped brms model whose conversion fails keeps a logicaldetrend.On main, the new
type,size_title, anddetrendexpectations fail. Locally the full suite fails onlytest_performance - lavaanin test-test_performance.R, which also fails on main.R CMD checkgives no warning.