Skip to content

Friedland Chapter 9 Bornhuetter-Ferguson Technique#1109

Merged
henrydingliu merged 165 commits into
casact:experimentalfrom
priyam0k:friedland/chapter-9-bf
Jul 12, 2026
Merged

Friedland Chapter 9 Bornhuetter-Ferguson Technique#1109
henrydingliu merged 165 commits into
casact:experimentalfrom
priyam0k:friedland/chapter-9-bf

Conversation

@priyam0k

@priyam0k priyam0k commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Adds a first draft of Chapter 9 – Bornhuetter-Ferguson Technique, recreating the XYZ Insurer Auto BI exhibits from Friedland Chapter 9. Like Chapters 8 and 11, it's a notebook with reconciliation asserts built in.

Everything is computed in-package (Development + TailConstant + BornhuetterFerguson), reusing the Chapter 7 XYZ selection (volume-weighted 2-period; 1.000 reported / 1.010 paid tail; age-to-age factors rounded to 3 decimals per the text). It recreates both exhibits — Ultimate Claims Projection and Development of Unpaid Claim Estimate — and reconciles exactly: ultimate 513,145 / 554,543 and IBNR 63,519 / 104,917 (reported / paid).

misc:

  • adds an Earned Premium column to the friedland_xyz_auto_bi sample (CSV + load_sample) so the a priori premium is read natively instead of hardcoded (same approach as Friedland Chapter 11 #1079).

Related GitHub Issue(s)

refers #588

Additional Context for Reviewers

  • The Earned Premium change is additive; Chapters 6 and 7 only select Reported Claims/Paid Claims, and their doctests still pass (35/35 and 76/76).

  • Chapter 9 is a notebook, so its asserts run at build (execute_notebooks: force) and a failure surfaces as a warning, per the Chapter 11 convention.

  • Note: Friedland Chapter 11 #1079 is separately adding XYZ premium to the freq-sev sample — worth reconciling once it merges so premium isn't carried twice.

  • I passed tests locally for code (pytest) and documentation (jb build docs --builder=custom --custom-builder=doctest)


Note

Low Risk
Documentation-only change (notebook + TOC); no application or library code in this diff.

Overview
Adds Friedland Chapter 9 to the docs as a new Jupyter notebook and links it in docs/_toc.yml under the Friedland section.

The notebook walks through the XYZ Insurer Auto BI Bornhuetter–Ferguson example using in-package Development, TailConstant, and BornhuetterFerguson (Chapter 7 development selection, a priori via sample_weight, reported CDF cap at 1.0). It rebuilds the ultimate projection and unpaid-claims exhibits and ends with numpy asserts that lock CDFs, ultimates, and IBNR to the printed Chapter 9 values.

Reviewed by Cursor Bugbot for commit 599e826. Bugbot is set up for automated code reviews on this repo. Configure here.

henrydingliu and others added 13 commits May 30, 2026 23:11
* Improved docstring and added examples

* Added the link ratios

* docs: add doctest examples for correlation classes

Adds Sphinx doctest Examples sections to DevelopmentCorrelation and ValuationCorrelation. Each example opens with the Mack chain-ladder assumption being tested, prints the full decision signal (statistic, confidence band, and boolean) rather than a single boolean, and ties the result back to the chain-ladder workflow.

Refs casact#704

* docs: add BootstrapODPSample doctest examples

Adds Sphinx doctest Examples section to the BootstrapODPSample class showing basic fit (resampled_triangles_.shape and scale_), downstream stochastic IBNR via Chainladder, and the effect of drop_high on scale_. Uses random_state=42 and n_sims=100 for deterministic, fast output.

Refs casact#704

* docs: reframe drop_high example as sensitivity check

Rewords the paragraph introducing the drop_high=True example to describe it as a leave-one-out sensitivity check on the column maxima rather than outlier removal, since drop_high mechanically removes the column max without any outlier test.

Addresses review feedback on casact#836.

* docs: move per-diagonal vs total mode note between testcode blocks

Per @henrydingliu review on casact#844: opening paragraph now scoped to the calendar-effect concept; the per-diagonal vs whole-triangle distinction is introduced as a transition between the two testcode blocks.

Refs casact#704

* docs: add README documenting docs build sources and outputs (refs casact#845)

* Added the transformed link ratio triangle using fit_transform to examples

* Removed the multiple testouputs

* docs: address review feedback on docs README (refs casact#845)

- Drop the jb build internals + duplicate warnings note (kennethshsu)
- Rename 'tutorial notebooks' to 'onboarding and Quickstart notebooks' (kennethshsu)
- Drop the 'What to edit for which part of the site' table and 'Known issues' section as redundant with the Source files table and casact#841 (kennethshsu)

* [REFACTOR]: Remove repetitive code. Remove dead Python 3.8 code. Add missing unit tests.

* [FIX]: Limit test to only those values meant to be changed. Use realistic values for changed options.

* [DOCS]: Finish updating Options docstring.

* [FIX]: Fix ending state of test.

* [FIX]: Reset backend after sparse-only run.

* [REFACTOR] Create template fixture for sample data sets.

* [Fix]: Remove duplicate fixture.

* [REFACTOR]: Move datetime defaults out of Options. Add validation to option getters and setters. Deprecate cl.array_backend() and cl.auto_sparse()

* FIX: Apply Bugbot fix.

* FIX: Apply Bugbot fix.

* FIX: Apply Bugbot fix.

* DOCS: Add docstring, clean up test.

* DOCS: Update docstring.

* Friedland Chapter 6 and half of Chapter 7 (casact#837)

first batch of deliverables for friedland reconstruction

* Delete docs/library/generated/chainladder.Development.rst

---------

Co-authored-by: Kenneth Hsu <kennethshsu@gmail.com>
Co-authored-by: priyam0k <87162535+priyam0k@users.noreply.github.com>
Co-authored-by: Gene Dan <genedan@gmail.com>
Recreate the XYZ Insurer Auto BI BF exhibits (ultimate claims projection and unpaid claim estimate) as a notebook, computed in-package and reconciled to Friedland via hidden asserts. Add an Earned Premium column to the friedland_xyz_auto_bi sample (CSV + load_sample) so premium is read natively, and wire chapter_9 into the docs TOC.

Refs casact#588
@priyam0k priyam0k marked this pull request as ready for review July 12, 2026 03:36
@henrydingliu henrydingliu deleted the branch casact:experimental July 12, 2026 04:03
@henrydingliu henrydingliu reopened this Jul 12, 2026
@henrydingliu

Copy link
Copy Markdown
Member

@priyam0k experimental is backed up. i created a clean experimental to prioritize your work. please resolve conflicts

@priyam0k priyam0k changed the title Friedland Chapter 9 — Bornhuetter-Ferguson Technique Friedland Chapter 9 Bornhuetter-Ferguson Technique Jul 12, 2026
priyam0k added 2 commits July 12, 2026 09:49
…hapter-9-bf

# Conflicts:
#	chainladder/core/pandas.py
#	chainladder/development/incremental.py
#	chainladder/utils/data/friedland_xyz_auto_bi.csv
#	chainladder/utils/utility_functions.py
#	docs/_templates/autosummary/class.rst
#	docs/_templates/autosummary/class_inherited.rst
#	docs/user_guide/methods.ipynb
@github-actions

github-actions Bot commented Jul 12, 2026

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): 14.5% of exported symbols fully typed (185 / 1272)

Known Ambiguous Unknown Total
Project (head) 185 106 981 1272

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 313
  • 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 Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.50%. Comparing base (32ae098) to head (599e826).

Additional details and impacted files
@@              Coverage Diff              @@
##           experimental    #1109   +/-   ##
=============================================
  Coverage         90.50%   90.50%           
=============================================
  Files                91       91           
  Lines              5289     5289           
  Branches            671      671           
=============================================
  Hits               4787     4787           
  Misses              359      359           
  Partials            143      143           
Flag Coverage Δ
unittests 90.50% <ø> (ø)

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.

@henrydingliu henrydingliu merged commit d81951d into casact:experimental Jul 12, 2026
11 checks passed
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.

4 participants