Skip to content

Refactor compute_bootci to use scipy.stats.bootstrap#505

Merged
raphaelvallat merged 2 commits intomainfrom
scipy_bootstrap
Mar 28, 2026
Merged

Refactor compute_bootci to use scipy.stats.bootstrap#505
raphaelvallat merged 2 commits intomainfrom
scipy_bootstrap

Conversation

@raphaelvallat
Copy link
Copy Markdown
Owner

Closes #189

Summary

Replaces the internal bootstrap implementation in compute_bootci with scipy.stats.bootstrap, raises the minimum SciPy requirement to 1.10, and upgrades the default CI method to BCa.

Changes

compute_bootci

Before After
Custom NumPy bootstrap loop Delegates to scipy.stats.bootstrap
Default method: cper (bias-corrected percentile, legacy) Default method: bca (bias-corrected and accelerated)
Supported: norm, per, cper Supported: bca, per, basic, norm
  • New default — bca: corrects for both bias and skewness via jackknife resampling; the
    gold-standard method recommended in the bootstrap literature.
  • New method — basic: basic (pivotal) bootstrap.
  • Removed — cper: legacy bias-corrected percentile method (no acceleration); superseded by
    bca.
  • Vectorized built-in functions (mean, std, var) now use axis=-1 convention required by
    scipy.stats.bootstrap.

Minimum SciPy version

Bumped from 1.8.01.10.0 in pyproject.toml and CI matrix.
scipy.stats.bootstrap gained the BCa method in 1.9 and stabilized in 1.10.

Tests & docs

  • Removed cper-specific test cases; added bca and basic to the combination test.
  • Updated expected CI values to match the new scipy-backed implementation.
  • Cleaned up docstring examples (removed redundant SciPy comparisons, updated output values).

Breaking changes

  • method="cper" (and "cpercentile") is no longer valid — raises AssertionError.
  • The default CI has changed from cper to bca; numerical outputs will differ for existing
    code that relied on the default.
  • SciPy ≥ 1.10 is now required.

@raphaelvallat raphaelvallat self-assigned this Mar 14, 2026
@raphaelvallat raphaelvallat added this to the 0.6.1 milestone Mar 14, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.36%. Comparing base (f08cc88) to head (74aa59f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #505      +/-   ##
==========================================
- Coverage   98.36%   98.36%   -0.01%     
==========================================
  Files          19       19              
  Lines        3311     3305       -6     
  Branches      492      488       -4     
==========================================
- Hits         3257     3251       -6     
  Misses         32       32              
  Partials       22       22              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@raphaelvallat raphaelvallat merged commit d5d618c into main Mar 28, 2026
26 checks passed
@raphaelvallat raphaelvallat deleted the scipy_bootstrap branch March 28, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use scipy.stats.bootstrap in pingouin.compute_bootci

1 participant