Repository navigation
Conversation
Member
|
Please submit this PR with #722 |
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.
Description
In
means_ratio()(R/means_ratio.R:175),.limit_ci()is called whileoutis still on the log scale (beforeif (!log)exponentiates the estimate and CI bounds on lines 180–186), but it passes0as the lower limit:For
alternative = "less", this fixesCI_lowto0on the log scale:log = TRUE,CI_lowis0instead of-Inf(and produces an inverted interval when the log means ratio is negative).log = FALSE,exp(0) = 1setsCI_lowto1instead of0(and produces an inverted interval whenever the means ratio is< 1).Proposed Changes
R/means_ratio.R: change.limit_ci(out, alternative, 0, Inf)to.limit_ci(out, alternative, -Inf, Inf)soCI_lowis-Infon the log scale andexp(-Inf) = 0on the ratio scale.tests/testthat/test-rom.R: add a regression test coveringalternative = "less"andalternative = "greater"for bothlog = FALSEandlog = TRUE, including a ratio< 1.Minimal Reproducible Example
main):log = FALSE:0.52 | [1.00, 0.54](inverted;CI_low = 1 > CI_high)log = TRUE:-0.65 | [0.00, -0.62](inverted;CI_low = 0 > CI_high)log = FALSE:0.52 | [0.00, 0.54](CI_low = 0)log = TRUE:-0.65 | [-Inf, -0.62](CI_low = -Inf)Verification
testthat::test_file("tests/testthat/test-rom.R"): 40/40 passed.R/means_ratio.R): 4 failures intest-rom.R; restoringR/means_ratio.Rreturns to 40/40 passed.air formatand checked withlintr(0 lints).This PR was assisted by Gemini 4 Neon via Antigravity CLI; I have reviewed and verified the change.