Skip to content

Disposal#1021

Merged
henrydingliu merged 7 commits into
casact:disposal_rate_methodfrom
henrydingliu:disposal
Jun 19, 2026
Merged

Disposal#1021
henrydingliu merged 7 commits into
casact:disposal_rate_methodfrom
henrydingliu:disposal

Conversation

@henrydingliu

@henrydingliu henrydingliu commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary of Changes

Related GitHub Issue(s)

Additional Context for Reviewers

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

Note

Medium Risk
Introduces a new reserving path that derives link ratios and full triangles from disposal rates and ultimates; incorrect use could materially change IBNR projections, though scope is limited to the new estimator plus a small shared base-class refactor.

Overview
Adds DisposalRate, a new adjustment estimator on DevelopmentBase that implements Friedland’s disposal-rate approach: observed cumulative counts (or similar) are divided by supplied ultimates (sample_weight), weighted/fitted like other development factors, and transform rebuilds ldf_ from fitted disposal patterns and future run-off so full_triangle_ can extend the lower triangle.

The class is exported from chainladder.adjustments and the top-level package, with a regression test on the Friedland GL insurer closed-claim sample (fitted disposal rates and incremental lower-triangle deltas).

Refactor: _param_property moves from IncrementalAdditive to a shared static helper on DevelopmentBase (used by disposal and incremental fitting); DevelopmentBase type hints switch from TriangleLike to Triangle.

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

@henrydingliu henrydingliu merged commit 06f5676 into casact:disposal_rate_method Jun 19, 2026
8 checks passed

@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 2 potential issues.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 40f977f. Configure here.

"""
return self.fit(X, y, sample_weight).transform(X, sample_weight=sample_weight)
def _test(self, X, ult):
return 'test' No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Debug stub left in class

Low Severity

The new DisposalRate class ends with a _test method that ignores its arguments and always returns the string 'test'. Nothing in the repository calls it, so it looks like leftover scaffolding rather than part of the public API.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 40f977f. Configure here.

X_new.incr_disposal_ = self.incr_disposal_
X_new.ultimate_ = sample_weight.latest_diagonal
ibnr_pct = 1 - X_new.disposal_.align_pattern(X_new.disposal_rate_tri)
run_off = X_new.incr_disposal_ / ibnr_pct * X_new.ibnr_

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Zero divisor in runoff scaling

Medium Severity

In transform, future runoff is computed as incr_disposal_ / ibnr_pct * ibnr_. Where cumulative disposal already reaches 100% (ibnr_pct is zero) or ibnr_ is zero, division yields NaNs or infinities that can propagate into ldf_ and full_triangle_ instead of zero runoff.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 40f977f. Configure here.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.89744% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.09%. Comparing base (0f59a1b) to head (40f977f).
⚠️ Report is 21 commits behind head on disposal_rate_method.

Files with missing lines Patch % Lines
chainladder/adjustments/disposal.py 81.35% 6 Missing and 5 partials ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           disposal_rate_method    #1021      +/-   ##
========================================================
+ Coverage                 88.94%   89.09%   +0.14%     
========================================================
  Files                        89       91       +2     
  Lines                      5139     5228      +89     
  Branches                    660      666       +6     
========================================================
+ Hits                       4571     4658      +87     
- Misses                      398      400       +2     
  Partials                    170      170              
Flag Coverage Δ
unittests 89.09% <85.89%> (+0.14%) ⬆️

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.

1 participant