Skip to content

[BUG] Development(drop=...) can remove every link ratio at an age, and Chainladder then uses a factor of 1 without a warning #1661

Open

Description

@scks1

preserve keeps at least one link ratio for drop_high, drop_low, drop_above and drop_below, and it warns when it overrides them. The order of operations in the Development docstring leaves drop and drop_valuation outside preserve, which makes sense for an explicit choice. When that choice removes the only ratio at an age, the fit gives a NaN ldf_ for that age and no warning. cdf_ then treats the missing factor as 1.

On genins, 108-120 has one link ratio, from 2001. Dropping it moves total IBNR from 18,680,856 to 17,825,076.

import chainladder as cl

genins = cl.load_sample("genins")
dev = cl.Development(drop=("2001", 108)).fit(genins)
model = cl.Chainladder().fit(dev.transform(genins))
print(dev.ldf_.values[0, 0, 0, -1])
print(dev.cdf_.values[0, 0, 0, -1])
print(model.ultimate_.values[0, 0, 1, -1])
print(round(model.ibnr_.sum()))
print(genins.latest_diagonal.values[0, 0, 1, -1])

On main at a59efc9 with -W error::UserWarning, this prints

nan
1.0
5339085.0
17825076
5339085.0

The 2002 ultimate equals its latest diagonal, so the model applies no development past 108. drop_valuation="2009" gives the same NaN ldf_. Every origin from 2002 onward loses the 1.0177 factor, and the 855,780 drop in IBNR is the result.

A user who drops a ratio by hand may want this, but the fit should say that an age has no ratios left. A UserWarning naming the age would match the message preserve already gives, for example "No link ratios remain at ['108-120'] after drop and drop_valuation. Its ldf_ is NaN and cdf_ treats it as 1." Raising an error is the other option if you think a fit with an empty age should not go through.

#1658 hit this while looping leave-one-out refits over every link ratio. Which behavior would you prefer?

(This issue was written with Árbol, an AI assistant, under my direction.)

Activity

  1. henrydingliu commented on Nov 18, 2026

    @henrydingliu
    Member

    drop and drop_valuation intentionally don't warn. we assume that the user has examined the underlying triangle and are consciously making the decision to drop.

    drop_hi/lo and drop_above/below are more generic parameters that may be on the default pipeline in a reserving workflow. it used to warn whenever preserve is triggered. we've since tightened it to not warn when preserve is triggered by the natural shape of the triangle, i.e. the tail of the triangle.

    so the issue comes down to, are there scenarios where the user is intentionally using drop and drop_valuation but should be warned.

    • for drop_valuation, this only happens if it's the latest valuation. the user should already know that they are dropping off the latest valuation. warning is not needed
    • for drop, this only happens if the user specifically supplies the last development period in the drop parameter. they likely already have a tail estimator attaching at one development period prior. warning is likely not needed

    on the whole, i think a warning would be redundant. we can clarify the warning behavior in the docstring.

  2. scks1 commented on Nov 18, 2026

    @scks1
    ContributorAuthor

    Thanks, that makes sense for a user who attaches a tail at the dropped age. I checked it on genins with drop=("2001", 108) on main at cc3335c.

                                         ldf_ 108-120  cdf_ 108-Ult  ibnr_.sum()
    no drop, no tail                         1.017725      1.017725  18680855.61
    drop, no tail                                 nan      1.000000  17825075.70
    drop, TailConstant(1.05)                      nan      1.050000  20434233.98
    drop, TailCurve()                             nan      1.033145  19554683.91
    drop, TailCurve(attachment_age=108)      1.021915      1.055787  20647872.63
    

    TailCurve(attachment_age=108) fills the dropped age, as you describe. A tail that attaches after the last age leaves 108-120 as NaN, so cdf_ at 108 holds only the tail factor. None of these fits warns.

    A check on any NaN ldf_ would be too broad. On clrd, 292 of 779 CumPaidLoss triangles have a NaN ldf_ at some age with no drop at all. A narrower rule would warn only when drop or drop_valuation empties an age and that age still has a NaN ldf_ when a method fits. If you'd rather keep it to the docstring, a note could say that only a tail attached at or before the dropped age replaces its factor. With no tail or a later tail, cdf_ uses 1 for that age.

    Which would you prefer?

    (This comment was written with Árbol, an AI assistant, under my direction.)

  3. henrydingliu commented on Nov 19, 2026

    @henrydingliu
    Member

    we could just mirror the drop_hi/lo and say that drop/drop_valuation are not protected by preserve

    image
  4. scks1 commented on Nov 19, 2026

    @scks1
    ContributorAuthor

    Mirroring them works for me. drop and drop_valuation could each end with "Not protected by preserve." I'd add one sentence after it, because the result surprised me on genins. "If this removes every link ratio at an age, ldf_ is NaN there and cdf_ treats it as 1 unless a tail attaches at or before that age."

    None nan 1.0
    TailCurve() nan 1.033145
    TailCurve(attachment_age=108) 1.0219154962694748 1.055787
    
    Code
    import chainladder as cl
    
    genins = cl.load_sample("genins")
    dev = cl.Development(drop=("2001", 108)).fit_transform(genins)
    for tail in (None, cl.TailCurve(), cl.TailCurve(attachment_age=108)):
        fit = dev if tail is None else tail.fit_transform(dev)
        print(tail, fit.ldf_.values[0, 0, 0, 8], fit.cdf_.values[0, 0, 0, 8].round(6))

    The change is two docstring lines, so I'll leave it open for a new contributor.

    (This comment was written with Árbol, an AI assistant, under my direction.)

  5. updated Priority Medium, Effort Low and Scope Documentation on Nov 19, 2026
  6. added this to the v1.0.0 milestone on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Great First Contribution! 🌱Beginner friendly tickets with narrow scope and huge impact. Perfect to get your feet wet!

    Type

    No type

    Fields

    Priority

    Medium

    Scope

    Documentation

    Effort

    Low

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions