Discrepancies in reporting for models of class svycoxph#1189
Discrepancies in reporting for models of class svycoxph#1189strengejacke merged 6 commits intomainfrom
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 resolves an issue where standard errors were not being reported correctly for 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 primarily addresses discrepancies in reporting for svycoxph models by correctly handling robust standard errors in standard_error.coxph. The change correctly identifies whether robust standard errors were used and extracts the appropriate values from the model summary. Most other changes are stylistic, improving code formatting and readability. My feedback focuses on making the standard error extraction more robust by using column names instead of indices, which will improve maintainability.
|
@gemini-code-assist review |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with incorrect standard errors for coxph objects, particularly for svycoxph models using robust standard errors. The core logic change in standard_error.coxph correctly identifies and extracts robust standard errors when available. A new ci.coxph method is also introduced to suppress verbose output from these models. The changes are supported by a new test case for svycoxph models.
My review has identified a critical issue in the new test where an undefined variable is used, which will cause the test to fail. Additionally, I've pointed out some stylistic inconsistencies in code formatting that could be addressed to improve maintainability. Overall, the fix itself is correct and valuable, but the test requires a minor correction.
There was a problem hiding this comment.
Pull request overview
Addresses incorrect reporting for survey-weighted Cox models (notably svycoxph) by ensuring robust standard errors (and derived CIs) are used and by suppressing noisy survey design printing during parameter extraction.
Changes:
- Update
standard_error.coxph()to select robust SEs when the fitted model uses robust variance, while silencingsummary()output. - Add a
ci.coxph()method that silences output during CI computation. - Add/adjust tests and update NEWS + package version.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/testthat/test-coxph.R |
Adds a regression test for svycoxph robust SE/CI behavior; minor formatting changes in existing expectations. |
R/methods_survival.R |
Adjusts coxph SE extraction to prefer robust SEs when available; adds ci.coxph wrapper to suppress output. |
NEWS.md |
Documents the bug fix in standard errors for Cox models. |
NAMESPACE |
Registers S3method(ci, coxph). |
DESCRIPTION |
Bumps package version to 0.28.3.2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #1174