Feature: add bootstrap CI to the rwa method#6
Conversation
work in progress code - does not work yet
|
Hey Martin,
The code in there for review doesn't seem to match any of the material I
sent for implementing the bootstrap. How can I best help integrate that?
Best,
Scott T
…On Tue, Jun 29, 2021 at 6:16 AM Martin Chan ***@***.***> wrote:
@martinctc <https://github.com/martinctc> requested your review on: #6
<#6> Feature: add bootstrap CI to
the rwa method.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#6 (comment)>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIT53LWAU2G7XD5VX5BQBADTVGMOLANCNFSM4XDUG75A>
.
|
Hey @stonid this pull request is still a draft and I haven't properly coded anything yet! Just wanted to add you to this, will ping you when it is ready for review. |
|
Got it. I got a ping that I was supposed to review and was confused.
…On Wed, Jun 30, 2021, 4:02 PM Martin Chan ***@***.***> wrote:
Hey Martin,
The code in there for review doesn't seem to match any of the material I
sent for implementing the bootstrap. How can I best help integrate that?
Best,
Scott T
On Tue, Jun 29, 2021 at 6:16 AM Martin Chan *@*.***>
wrote:
@martinctc <https://github.com/martinctc> https://github.com/martinctc
requested your review on: #6 <#6>
#6 <#6> Feature: add bootstrap CI to
the rwa method.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
#6 (comment) <#6 (comment)>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AIT53LWAU2G7XD5VX5BQBADTVGMOLANCNFSM4XDUG75A
.
Hey @stonid <https://github.com/stonid> this pull request is still a
draft and I haven't properly coded anything yet! Just wanted to add you to
this, will ping you when it is ready for review.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIT53LRCXHVXSKZ2ETKINDDTVNZ6JANCNFSM4XDUG75A>
.
|
…d enforce suggest checks
…e R package checks
… additional metrics
…tandardizing OS to ubuntu-latest
There was a problem hiding this comment.
Pull Request Overview
This PR introduces bootstrap confidence interval functionality into the rwa() function, enabling statistical inference on relative weights. It also updates documentation, vignettes, and CI/CD to support the new feature.
- Added full bootstrap infrastructure with multiple CI methods in
R/bootstrap_rwa.Rand integrated it intorwa() - Extended documentation (
man/*.Rd,vignettes/*.Rmd,README.md) to cover bootstrap parameters and examples - Updated CI/CD workflow and package metadata for Pandoc support, CRAN compliance, and new dependencies
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| R/rwa.R | Integrated bootstrap, n_bootstrap, conf_level, focal, comprehensive, include_rescaled_ci parameters and logic |
| R/bootstrap_rwa.R | Implemented bootstrap sampling and CI extraction functions |
| man/rwa.Rd | Updated Rd usage, arguments, and examples for bootstrap |
| man/run_rwa_bootstrap.Rd | Added internal documentation for bootstrap helper |
| man/extract_ci.Rd | Added internal documentation for CI extraction |
| vignettes/introduction-to-rwa.Rmd | New detailed vignette covering basic and bootstrap features |
| vignettes/README.md | Added instructions to access the vignette |
| README.md | Updated to highlight bootstrap CIs and documentation |
| DESCRIPTION | Bumped version, modernized Authors field, added new imports |
| NAMESPACE | Imported new functions from boot, purrr, utils |
| .github/workflows/R-CMD-check.yaml | Switched to Ubuntu runner, added Pandoc setup and artifact upload |
| .Rbuildignore | Added _dev to ignore list |
Comments suppressed due to low confidence (1)
R/rwa.R:20
- The new bootstrap parameters and logic are not covered by any unit tests. Please add tests for
rwa(..., bootstrap = TRUE)and for the underlying bootstrap helper functions (e.g.,run_rwa_bootstrap,extract_ci) to ensure correct behavior.
#' @param bootstrap Logical value specifying whether to calculate bootstrap confidence intervals. Defaults to `FALSE`.
| #' @keywords internal | ||
| #' Bootstrap statistic function for basic RWA weights | ||
| #' @noRd | ||
| rwa_boot_statistic <- function(data, indices, outcome, predictors) { |
There was a problem hiding this comment.
[nitpick] The functions rwa_boot_statistic and rwa_boot_statistic_rescaled share nearly identical data preparation and eigen decomposition code. Consider extracting the common steps into a helper to reduce duplication and simplify future maintenance.
| ci_results <- purrr::map_dfr(1:n_weights, function(i) { | ||
| tryCatch({ | ||
| # Try BCA first | ||
| ci <- boot::boot.ci(boot_object, type = "bca", index = i, conf = conf_level) |
There was a problem hiding this comment.
[nitpick] Extracting CIs by calling boot::boot.ci inside a loop for each weight can be slow for large bootstrap samples. Consider offering an option to use a faster percentile‐only method or parallelizing the CI extraction to improve performance.
Summary
This branch adds bootstrap confidence intervals for Relative Weights Analysis, enabling statistical significance testing of predictor importance - a major enhancement addressing a long-standing limitation in RWA methodology.
Changes
The changes made in this PR are:
R/bootstrap_rwa.R) with BCA, percentile, and basic CI methodsrwa()with bootstrap parameters (bootstrap,n_bootstrap,conf_level,focal,comprehensive,include_rescaled_ci)vignettes/introduction-to-rwa.Rmd) showcasing methodology, examples, and best practicesCheck
Key Features Added
🎯 Bootstrap Confidence Intervals
📊 Statistical Methodology
📚 Documentation Excellence
🔧 Technical Implementation
Impact and Significance
This enhancement addresses a critical gap identified by Tonidandel et al. (2009):
The bootstrap implementation provides an empirical solution to this long-standing methodological challenge, making the
rwapackage one of the most comprehensive tools for relative importance analysis in R.Usage Examples
Note
This major feature addition maintains full backward compatibility while providing cutting-edge statistical capabilities for relative weights analysis. The implementation follows best practices for R package development and provides a foundation for future enhancements to the relative importance analysis ecosystem.
This fixes #1.