Repository navigation
Conversation
DevelopmentCorrelation took Mack's I from the number of development columns and turned a missing Spearman coefficient into T_k = 1. A triangle without link ratios got T = 1 and was flagged, and a triangle with fewer origins holding data than the grid has columns got the wrong T and variance. Each T_k now uses the pairs (F_ik, F_i,k-1) present in its triangle: ranks among those pairs, weight n_k - 1, and Var(T) = 1 / sum(n_k - 1), per triangle. On a complete triangle n_k = I - k, and the results are unchanged. A triangle without a column of two pairs gets NaN for T and its variance and is not flagged, so 2 x 2 and 3 x 3 triangles no longer raise. t_variance is now a DataFrame shaped like t_expectation, and confidence_interval is a tuple of two such DataFrames. Closes casact#1577. Developed with an AI assistant (Árbol, running Muse).
scks1
requested review from
genedan,
henrydingliu and
kennethshsu
as code owners
November 10, 2026 22:40
2 of 4 tasks
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 / 7)
Patch symbol details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1579 +/- ##
=======================================
Coverage 94.59% 94.60%
=======================================
Files 98 98
Lines 6233 6241 +8
Branches 799 800 +1
=======================================
+ Hits 5896 5904 +8
Misses 216 216
Partials 121 121
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:
|
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
DevelopmentCorrelationnow computes each T_k from the adjacent-factor pairs present in its triangle, weights it by one less than its number of pairs (Mack's description of the weights I − k − 1) and takes Var(T) as one over the total weight, per triangle. Complete triangles are unchanged: all 2,336 in the bundled samples are bit-identical to main. A triangle without a column of two pairs gets NaN and no flag, as #1262 did for empty diagonals.t_varianceis now a DataFrame shaped liket_expectation, andconfidence_intervala tuple of two of them. A scalar cannot hold one variance per triangle, hence[BRK]with no deprecation period.New tests cover a complete triangle, an empty one, an object with one empty member (
auto), the late-startraacase from #1577, and 2 × 2 to 4 × 4 triangles.Related GitHub Issue(s)
Closes #1577.
AI/LLM Usage
This change was made with Árbol, an AI assistant running on Muse, working under my direction. It wrote the fix and the tests, ran the checks below and drafted this description.
Additional Context for Reviewers
ValueErrorproposed in the issue, so one small member does not fail a whole object, as jbogaardt suggested in Independence tests for Chain Ladder #76.dropordrop_highnow count as missing. Onraawith the 1982 factor at age 12 dropped, T goes from 0.0696 (main ignores the drop) to 0.1974, flagged at the defaultp_critical. Withdrop_high=Trueit goes from -0.3004 to 0.1966.clrd, 1,733 of 4,650 triangles change T and 837 become NaN, 219 of them empty.test_correlation.pypasses (29 tests) with the uv.lock versions and with numpy 2.5.4 and pandas 3.1.0, and ruff is clean.conftest.py. Taking this side of the first and keeping both fixtures in the second resolves them, andtest_correlation.pypasses on both merged trees.Submitter's Checklist
[FIX],[FEAT],[DOCS],[TST],[CHORE], or[BRK]).Reviewer's Checklist