Repository navigation
Add comparison = "ratio" as shortcut - #672
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
2 open findings
What changed in this PR
Adds a new comparison = "ratio" shortcut to estimate_contrasts() / marginal contrasts generation, so users can request pairwise ratios without writing formula syntax.
Changes:
- Add
"ratio"as a recognizedcomparisonstring and internally map it toratio ~ pairwise. - Update formatting logic to treat
"ratio"like the formula-based ratio comparison. - Add NEWS + documentation updates and a new test covering the shortcut.
| File | Description |
|---|---|
| tests/testthat/test-estimate_contrasts.R | Adds test asserting comparison="ratio" returns expected columns/value |
| R/get_marginalcontrasts.R | Implements "ratio" shortcut mapping and allows "ratio" in validation |
| R/format.R | Updates ratio-detection logic to support string "ratio" as well as formulas |
| R/estimate_contrasts.R | Documents "ratio" as a supported comparison string and explains behavior |
| NEWS.md | Announces new comparison="ratio" shortcut |
| DESCRIPTION | Bumps package version |
Files not reviewed (2)
- man/estimate_contrasts.Rd: Generated file
- man/get_emmeans.Rd: Generated file
🧠 Review effort: Lite
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| expect_named(out, c("Level1", "Level2", "Ratio", "SE", "CI_low", "CI_high", "z", "p")) | ||
| expect_equal(out$Ratio, 6.14634, tolerance = 1e-4) |
There was a problem hiding this comment.
exp(coef()) returns an odds ratio, while estimate_contrasts(m, "sex", comparison = "ratio") computes the ratio between two predicted probabilities, i.e. a risk ratio.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>


No description provided.