Skip to content

Friedland Chapter 15 - DC Insurer monitoring (Exhibit IV) - #1224

Open
EKtheSage wants to merge 4 commits into
casact:mainfrom
EKtheSage:friedland/chapter-15-monitoring
Open

EKtheSage wants to merge 4 commits into
casact:mainfrom
EKtheSage:friedland/chapter-15-monitoring

Conversation

@EKtheSage

Copy link
Copy Markdown
Contributor

Summary

  • Add docs/friedland/chapter_15_monitoring.ipynb recreating Friedland Exhibit IV Sheets 2-4: selected ultimates at 12/31/2007, then annual and monthly actual-versus-expected reported claims.
  • Uses DevelopmentConstant / Chainladder for the Sheet 2 ultimates and the printed reporting-pattern formula for expected emergence. No new sample CSV — Sheet 1's quarterly triangle is not required for the monitoring tests.
  • Independent of Friedland Chapter 15 - Evaluation of Techniques (comparison tables) #1220 (comparison tables) and of the Chapter 7-10 JSON estimators.

Related to #588.

Test plan

  • pytest --nbmake docs/friedland/chapter_15_monitoring.ipynb
  • Confirm AY 2007 ultimate is 2,798 and expected CY 2008 reported is 332
  • Confirm AY 2006 expected emergence is 3
  • Confirm interpolated Jan/Feb 2008 percent reported for AY 2007 is 91.5% / 95.0%

Made with Cursor

Recreate Exhibit IV Sheets 2-4 (actual-versus-expected reported) without depending on Chapters 7-10 JSON.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Aug 18, 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): 15.0% of exported symbols fully typed (207 / 1382)

Known Ambiguous Unknown Total
Project (head) 207 111 1064 1382

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: 327
  • 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread docs/friedland/chapter_15_monitoring.ipynb Outdated
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.79%. Comparing base (d82c521) to head (f927dc4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1224   +/-   ##
=======================================
  Coverage   91.79%   91.79%           
=======================================
  Files          96       96           
  Lines        5494     5494           
  Branches      707      707           
=======================================
  Hits         5043     5043           
  Misses        327      327           
  Partials      124      124           
Flag Coverage Δ
unittests 91.79% <ø> (ø)

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

Copy link
Copy Markdown
Member
  • does dc insurer need to be added as a sample dataset?
  • calculating expected for the next calendar period is a relatively common task. do you think we need to add it as a property/method of Triangle?

@EKtheSage

Copy link
Copy Markdown
Contributor Author

On the two questions:

DC Insurer as a sample dataset. I would not add one in this PR. Sheets 2-4 only use the 12/31/2007 latest diagonal and the selected CDFs. The quarterly triangle in Sheet 1 was not reconstructable from the PDF extract, and the other Friedland samples exist because those chapters reuse the full triangle. Shipping friedland_dc_insurer would be CSV + _manifest.py + load tests + the sample-data table, which is library surface rather than this docs slice. If someone later has a clean Sheet 1 reconstruction, that can be its own sample PR.

Expected emergence as a Triangle property/method. I would not add one here either. Fitted objects already expose the next-period expected:

  • full_expectation_ — expected cumulative at each age
  • full_triangle_ — actuals plus expected runoff
  • model_diagnostics()Run Off 1/2/3... from full_expectation_

Friedland's formula is the incremental expected from full_expectation_.cum_to_incr() at the next lag. Sheet 4 is the part that is not a general Triangle grain: it interpolates percent-reported between quarterly knots for monthly A/E. That helper stays in the notebook. A dedicated API would be a separate issue with tests and docs, not this notebook.

@henrydingliu

Copy link
Copy Markdown
Member

The quarterly triangle in Sheet 1 was not reconstructable from the PDF extract

this is not true. Based on the selected tail factor, we can safely assume there's no development beyond 36 months

and the other Friedland samples exist because those chapters reuse the full triangle

this is also not true. there are single diagonal datasets from chapter 8 that are loaded as sample data.

Fitted objects already expose the next-period expected:

please use the fitted object in the exhibit. the point is to use chainladder objects to produce matching exhibits, rather than demonstrating pandas manipulation.

…d model

Henry's review: ship the two diagonals like the chapter 8 single-diagonal samples, and take CY 2008 expected emergence from full_triangle_ instead of a numpy formula.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EKtheSage

EKtheSage commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Those two claims were wrong. Chapter 8 already ships single-diagonal samples (friedland_auto_bi_insurer), and a 1.000 CDF at 36 months is enough to finish the development pattern.

Pushed a follow-up that:

  • adds friedland_dc_insurer with the 12/31/2007 and 12/31/2008 reported diagonals
  • takes Sheet 3 expected emergence from the fitted Chainladder model (full_triangle_.dev_to_val() at 2008 minus the 2007 latest_diagonal)

Sheet 4 still interpolates the quarterly percent-reported pattern because the sample is annual grain. No new Triangle method. full_triangle_ already does the next calendar period.

@henrydingliu

Copy link
Copy Markdown
Member
  • general
    • weird characters in the headers
  • sheet 1
    • can you please add the full triangle to the repo and recreate this exhibit?
  • sheet 2
    • please try model_diagnostics to reduce amount of numpy and pandas manipulation
  • sheet 4
    • i'm good with this, but will raise a separate issue to add interpolation functionality

@henrydingliu

Copy link
Copy Markdown
Member

@EKtheSage bump

…rop the mojibake dashes, and build Sheet 2 from model_diagnostics.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EKtheSage

Copy link
Copy Markdown
Contributor Author

Headings no longer use en/em dashes.

friedland_dc_insurer is now the quarterly Sheet 1 triangle (ages 3-36), with the 12/31/2007 carry-forward (no development after 36 months) and the 12/31/2008 diagonal. The notebook prints that triangle and the selected CDFs.

Sheet 2 Latest / CDF / Ultimate come from model_diagnostics on the fitted Chainladder model.

@henrydingliu

Copy link
Copy Markdown
Member

looks good! please resolve conflict and i can approve.

…5-monitoring

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	chainladder/utils/data/_manifest.py
#	docs/_toc.yml
@EKtheSage

Copy link
Copy Markdown
Contributor Author

"Merged upstream/main into this branch.\n\nConflict resolution:\n- docs/_toc.yml: keep both chapter 11 and chapter 15\n- chainladder/utils/data/_manifest.py: keep the DC Insurer sample, keep main\u0027s Incremental Paid Severity on xyz_auto_bi, drop xyz_disp. Module docstring is D213 so the new ruff select on this touched file is green."

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f927dc4. Configure here.

"scale_feb = np.divide(\n",
" ibnr_jan, unreported_jan, out=np.zeros(len(ibnr)), where=unreported_jan > 0\n",
")\n",
"expected_feb = np.round(scale_feb * (pct_feb - pct_jan), 0)\n",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

February expected uses actuals not original IBNR

Medium Severity

February expected emergence is built from remaining IBNR after January actuals (Projected Ultimate minus reported_jan), while January expected and the notebook formula both use the original fitted ibnr_ and the 12/31/07 percent reported. When January actuals miss the interpolated pattern, February expected no longer matches the static selected-ultimate emergence used on Sheet 3 and in Friedland's worked formula, so the monthly actual-versus-expected test can disagree with the printed exhibit by a large amount.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f927dc4. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EKtheSage can you please confirm this is hallucination?

@henrydingliu henrydingliu self-assigned this Sep 17, 2026
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.

2 participants