Repository navigation
Conversation
Development._param_property took the age labels for ldf_, sigma_ and std_err_ from X.link_ratio.ddims. link_ratio drops link-ratio columns with no ratio before the valuation date, so a triangle with more development ages than origins, such as raa[raa.origin >= "1983"], got 9 parameter values and 7 labels, and every method failed in nan_triangle. The labels now come from X.ddims[:-1], one per link ratio. The new test checks the labels on three origin subsets and compares Chainladder's IBNR with a hand chain ladder (Mack, 1993). Developed with an AI assistant (Árbol, running Muse).
CaseOutstanding._set_ldf took the age labels for ldf_ from X.link_ratio.ddims, which drops link-ratio columns with no ratio before the valuation date. On a triangle with more development ages than origins, such as comauto origins from 1992 in clrd, fit failed in nan_triangle (cannot reshape array of size 30 into shape (6,9)). The labels now come from X.ddims[:-1], as in Development. The new test checks the labels on three origin subsets and compares the paid IBNR with a hand case outstanding development (Friedland, 2010, ch. 12). Developed with an AI assistant (Árbol, running Muse).
scks1
requested review from
genedan,
henrydingliu and
kennethshsu
as code owners
November 16, 2026 20:19
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 0.0% fully typed (0 / 2)
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1636 +/- ##
==========================================
+ Coverage 95.00% 95.02% +0.02%
==========================================
Files 100 100
Lines 6461 6491 +30
Branches 820 827 +7
==========================================
+ Hits 6138 6168 +30
Misses 204 204
Partials 119 119
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
this is another one where i'd like to wait for #1304 to land. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Development._param_propertynow labelsldf_,sigma_andstd_err_withX.ddims[:-1], one age per link ratio, instead ofX.link_ratio.ddims.link_ratiodrops the link-ratio columns that have no ratio before the valuation date, so a triangle with more development ages than origins, such asraa[raa.origin >= "1983"], got 9 parameter values and 7 labels, and every method failed innan_triangle.CaseOutstanding._set_ldftook itsldf_labels the same way and now usesX.ddims[:-1]too.test_origin_subset_with_more_ages_than_originschecks that the labels match the value columns for all three parameters onraaorigins from 1982 and from 1983 and ongeninsorigins from 2004, on the numpy and sparse backends, and comparesChainladder's IBNR with a chain ladder computed in the test from the origins observed at both ages (Mack, 1993, p. 214). It fails on main at the label check and passes with the change.A test of the same name in
test_outstanding.pyfitsCaseOutstandingtoclrdcommercial auto origins from 1992 and from 1994 and tousautoorigins from 2002, checks the labels ofldf_,paid_ldf_andcase_ldf_, and compares the paid IBNR with the case outstanding development technique (Friedland, 2010, ch. 12, Approach 1) computed in the test. It fails on main infitand passes with the change.Related GitHub Issue(s)
Closes #1635
AI/LLM Usage
This change was made with Árbol, an AI assistant running on Muse, working under my direction. It found the bug, wrote the change and the test, ran the checks below and drafted this description.
Additional Context for Reviewers
ChainladderIBNR before and after:raa, origins from 1983raa, origins from 1982genins, origins from 2004raa, origins from 1983, first 8 agesraa, origins to 1988raa[FEAT] Hurlimann Credible Loss Ratio estimator #1553's
_ldf_likehelper already takes its labels fromX.ddims[:-1]for the same reason. [FEAT]deprecate date dims #1304 changes this line toX.link_ratio.developmentand still fails on these triangles, and [FEAT] IncrementalAdditive Cleanup for Chapter 16 Part 1 #1419 does not change the result.Paid IBNR after
CaseOutstandingbefore and after:clrdcomauto, origins from 1992clrdcomauto, origins from 1994usauto, origins from 2002clrdcomautousautoThe hand computation averages each ratio over the origins observed at both ages, as the estimator does by default, and adds no payment at an age no origin has reached. It matches main on all six
clrdlines and onusautobefore slicing.MackChainladderfits after this change, buttotal_mack_std_err_is NaN on these triangles, because the ages that no origin has reached get NaN factors and sigmas. That is a separate change and is not in this PR.The
chainladder/development,chainladder/coreandchainladder/methodstests pass (1247 passed, 8 skipped; 1238 passed on main), and ruff check and format are clean on the changed files.Submitter's Checklist
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist