Fix check_singularity.lme tolerance and dropped count-model hint - #947
Merged
Conversation
Member
|
Thanks, looks good to me! Let me also request an additional AI review |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Add the missing nlme regression test and correct the development NEWS/version placement.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes nlme singularity tolerance handling and restores the count-model hint in heteroscedasticity messages.
Changes:
- Corrects absolute-value placement in
check_singularity.lme. - Restores count-model guidance messaging.
- Adds regression coverage for the restored hint.
- Documents the fixes in
NEWS.md.
File summaries
| File | Summary |
|---|---|
tests/testthat/test-check_heteroskedasticity.R |
Tests the restored count-model hint. |
R/check_singularity.R |
Fixes the tolerance comparison; an nlme regression test remains needed. |
R/check_heteroscedasticity.R |
Restores count-model messaging. |
NEWS.md |
Documents the fixes; version and (devel) placement require adjustment. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| insight::check_if_installed("nlme") | ||
|
|
||
| any(abs(stats::na.omit(as.numeric(diag(nlme::getVarCov(x)))) < tolerance)) | ||
| any(abs(stats::na.omit(as.numeric(diag(nlme::getVarCov(x))))) < tolerance) |
Comment on lines
+5
to
+9
| * `check_singularity()` for models from package *nlme* now applies the | ||
| tolerance to the absolute values of the variance-covariance diagonal. | ||
|
|
||
| * `check_heteroscedasticity()` now includes the hint about overdispersion and | ||
| zero-inflation in the message for count models. |
Member
|
Thanks! Comments are minor and don't need to be addressed. |
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.
check_singularity.lme applies the tolerance to the wrong expression
In
R/check_singularity.R, thelmemethod closesabs()after the comparison:abs()receives the logical vector from< tolerance, not the variance estimates. The effective test isestimate < toleranceon the raw diagonal, so a strongly negative estimate counts as singular whatever its magnitude.check_heteroscedasticity drops the count-model hint
In
R/check_heteroscedasticity.R, the default method builds a longer message for count models but never assigns it, so the hint never reaches the user.Found during my most recent ry audit.