Skip to content

[DOCS] Add a gallery example comparing two methods on shared bootstrap draws - #1672

Open
scks1 wants to merge 1 commit into
casact:mainfrom
scks1:docs-paired-bootstrap-1664
Open

scks1 wants to merge 1 commit into
casact:mainfrom
scks1:docs-paired-bootstrap-1664

Conversation

@scks1

@scks1 scks1 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Adds docs/gallery/plot_paired_bootstrap.ipynb, a gallery example that fits two methods to the same BootstrapODPSample draws and looks at the difference on each draw. It compares TailCurve with TailBondy on genins, once on shared draws and once on draws from a second seed. It shows the identity Var(B − C) = Var B + Var C − 2 Cov(B, C), the ratio near √(1 − ρ), and that more draws shrink the standard error of the mean difference but leave the gap between the two standard deviations in place. The gallery index gets a card and a toctree entry, and docs/images/plot_paired_bootstrap.png is the card image.

Related GitHub Issue(s)

Closes #1664

AI/LLM Usage

I used Árbol, an AI assistant running on Muse, under my direction to write the notebook, run it and draft this description. I reviewed the notebook and its numbers.

Additional Context for Reviewers

Results on main 687e329, 1,000 draws with seeds 42 and 7:

TailBondy minus TailCurve mean sd
same draws -696,715 1,540,822
independent draws -702,384 4,728,455

The correlation of the two totals across shared draws is 0.885, √(1 − ρ) is 0.338 and the observed ratio of standard deviations is 0.326.

draws ratio standard error of the shared-draw mean
200 0.303 105,259
1,000 0.326 48,725
2,000 0.331 35,350
  • The notebook runs in about 17 seconds and peaks near 680 MB.
  • pytest --nbmake passes on the notebook, and ruff 0.16.1 check and format pass.
  • A full jb build docs with execution off succeeds. The new page adds no warnings, and the link to plot_bootstrap_comparison, the shapland2016 citation and the gallery card all resolve.
  • The example relies on one fit_transform call feeding both methods. [FEAT] Record the seed each random draw used as random_state_, and handle random_state as documented #1605 changes how estimators record random_state, and nothing in this notebook depends on that change.

Submitter's Checklist

  • I have reviewed and am adhering to the standards outlined in the project Governing Doc.
  • The PR subject title summarizes the changes, with one proper prefix ([FIX], [FEAT], [DOCS], [TST], [CHORE], or [BRK]).
  • I am a human (not a bot), and this PR form is written by a human.

Reviewer's Checklist

  • The implementation addresses the associated issue(s).
  • The implementation is appropriate, maintainable, and follows ARCHITECTURE.md.
  • PR subject title has the proper prefix and the subject is appropriate.
  • Relevant issue(s) are linked.
  • AI/LLM usage is disclosed and appropriate.
  • Documentation and tests are appropriate.
  • CI tests passed, or any failures are acceptable.
  • Leave a comment with the final recommendation (e.g. approve as is, request a secondary review, or flag an area for more review).

…p draws

The example fits TailCurve and TailBondy to the same 1,000
BootstrapODPSample draws of genins and to draws from a second seed. The
shared-draw difference in total IBNR has a standard deviation of
1,540,822 against 4,728,455 for independent draws, a ratio of 0.326,
close to sqrt(1 - rho) at a correlation of 0.885. A second table runs
200, 1,000 and 2,000 draws to show that the ratio stays near a third
while the standard error of the mean difference falls from 105,259 to
35,350.

Developed with an AI assistant (Árbol, running Muse).
@github-actions

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 18.1% of exported symbols fully typed (305 / 1682)

Known Ambiguous Unknown Total
Project (head) 305 96 1281 1682

Other symbols referenced but not exported by chainladder: 24

Known Ambiguous Unknown Total
Other (head) 11 1 12 24

Symbols without documentation:

  • Functions without docstring: 329
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected.

@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (687e329) to head (0e6b997).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1672   +/-   ##
=======================================
  Coverage   95.03%   95.03%           
=======================================
  Files         100      100           
  Lines        6471     6471           
  Branches      819      819           
=======================================
  Hits         6150     6150           
  Misses        203      203           
  Partials      118      118           
Flag Coverage Δ
unittests 95.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

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.

[DOC] Gallery example: compare two methods on the same bootstrap draws

1 participant