ci = NULL suppresses confidence intervals and SE#640
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for suppressing standard error and confidence interval calculations by setting the ci parameter to NULL or NA. The implementation updates get_marginalmeans and get_marginaltrends to handle these values, updates documentation across multiple functions, and adds relevant unit tests. The package version is bumped to 0.16.0.1 and the changes are documented in NEWS.md. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR updates the marginaleffects backend integration so that setting ci = NULL (and ci = NA) suppresses computation of standard errors and confidence intervals, aligning with the intent of improving performance/memory usage for large models (ref. #639).
Changes:
- Suppress SE/CI computation for marginaleffects calls by setting
vcov = FALSEwhenconf_levelisNULL/NA. - Add test coverage to ensure
ci = NULL/NAsuppresses CI output for means and slopes. - Update documentation/NEWS and bump package version.
Reviewed changes
Copilot reviewed 7 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
R/get_marginaltrends.R |
Disables variance-covariance computation when CI level is NULL/NA to suppress SE/CI for slopes. |
R/get_marginalmeans.R |
Disables variance-covariance computation when CI level is NULL/NA to suppress SE/CI for means. |
R/estimate_means.R |
Updates ci parameter documentation to describe suppression behavior. |
tests/testthat/test-estimate_slopes.R |
Adds tests asserting ci = NULL/NA suppresses CI output for slopes. |
tests/testthat/test-estimate_means_ci.R |
Adds tests asserting ci = NULL/NA suppresses CI output for means; also reformats existing assertions. |
man/get_emmeans.Rd |
Documents ci suppression behavior. |
man/estimate_slopes.Rd |
Documents ci suppression behavior. |
man/estimate_means.Rd |
Documents ci suppression behavior. |
man/estimate_expectation.Rd |
Documents ci suppression behavior. |
man/estimate_contrasts.Rd |
Documents ci suppression behavior. |
NEWS.md |
Notes behavior change for ci = NULL. |
DESCRIPTION |
Bumps version to 0.16.0.1. |
Files not reviewed (5)
- man/estimate_contrasts.Rd: Generated file
- man/estimate_expectation.Rd: Generated file
- man/estimate_means.Rd: Generated file
- man/estimate_slopes.Rd: Generated file
- man/get_emmeans.Rd: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #' @param ci Confidence Interval (CI) level. Must be numeric between 0 and 1. | ||
| #' Defaults to `0.95`. Use `NULL` to suppress calculation of standard errors and | ||
| #' confidence intervals. |
| \item{ci}{Confidence Interval (CI) level. Must be numeric between 0 and 1. | ||
| Defaults to \code{0.95}. Use \code{NULL} to suppress calculation of standard errors and | ||
| confidence intervals.} |
| out <- suppressMessages(estimate_slopes(model, ci = NULL)) | ||
| expect_named(out, "Slope") | ||
| out <- suppressMessages(estimate_slopes(model, ci = NA)) | ||
| expect_named(out, "Slope") |
|
nice one! |
#639