mismatch between {emmeans}\s and model_parameters()'s adjusted p-values#1194
Conversation
Summary of ChangesHello @strengejacke, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug where Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a mismatch in adjusted p-values between emmeans and model_parameters(). The core of the fix is in the Tukey p-value adjustment logic, where the nmeans parameter for stats::ptukey is now correctly calculated. The method for determining the number of comparisons (rank_adjust) has also been improved with a fallback mechanism. The changes are well-supported by new unit tests that validate the fix against emmeans output. Additionally, the pull request includes several formatting improvements that enhance code readability by breaking up long lines, which is a welcome change. Overall, this is a solid contribution that fixes an important bug and improves code quality.
|
@gemini-code-assist review |
There was a problem hiding this comment.
Code Review
This pull request addresses a mismatch in adjusted p-values between {emmeans} and model_parameters(). The core of the fix involves correcting the nmeans argument for Tukey p-value adjustments and adding new tests to ensure correctness. The changes are well-implemented and improve the reliability of p-value adjustments. I have one suggestion to remove a redundant line of code to improve maintainability.
There was a problem hiding this comment.
Pull request overview
This PR addresses #1103 by aligning model_parameters() p-value adjustment behavior with emmeans, focusing on Tukey adjustments for emmeans contrast objects.
Changes:
- Updated Tukey p-value adjustment logic used by
.p_adjust()for emmeans outputs. - Expanded test coverage to assert
model_parameters()p-values matchemmeans’ own adjustedp.valueacross additional Tukey scenarios. - Bumped package version and added a NEWS entry for the Tukey/emmeans adjustment fix.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/testthat/test-p_adjust.R |
Adds regression tests ensuring model_parameters() matches emmeans adjusted p-values (incl. additional Tukey cases). |
R/format_p_adjust.R |
Adjusts Tukey adjustment computation and rank/correction logic used during p-value adjustment. |
NEWS.md |
Documents the Tukey/emmeans p-value adjustment fix. |
DESCRIPTION |
Version bump from 0.28.3.3 to 0.28.3.4. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #1103