Skip to content

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

Open
EKtheSage wants to merge 1 commit into
casact:mainfrom
EKtheSage:friedland/chapter-15-monitoring
Open

Friedland Chapter 15 - DC Insurer monitoring (Exhibit IV)#1224
EKtheSage wants to merge 1 commit 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

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.9% of exported symbols fully typed (202 / 1355)

Known Ambiguous Unknown Total
Project (head) 202 111 1042 1355

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

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 80893d2. Configure here.

" \"\"\"Expected emergence between two valuations (Friedland Exhibit IV).\"\"\"\n",
" unreported = 1.0 - pct_from\n",
" emergence = np.where(unreported > 0, (ultimate - reported) / unreported, 0.0)\n",
" return emergence * (pct_to - pct_from)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unsafe zero-division in emergence

Low Severity

expected_reported uses np.where with a divide that still runs when pct_from is 1.0, so mature years trigger RuntimeWarning: invalid value encountered in divide. Those warnings are baked into the Sheet 3 and Sheet 4 outputs (including a local Users\EthanKang path), so the docs notebook renders with stderr noise even though the selected values stay 0.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 80893d2. Configure here.

@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.31%. Comparing base (e4b1f10) to head (80893d2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1224   +/-   ##
=======================================
  Coverage   91.31%   91.31%           
=======================================
  Files          91       91           
  Lines        5434     5434           
  Branches      700      700           
=======================================
  Hits         4962     4962           
  Misses        336      336           
  Partials      136      136           
Flag Coverage Δ
unittests 91.31% <ø> (ø)

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.

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