Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions chainladder/development/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ class Development(DevelopmentBase):
The minimum number of link ratio(s) required for LDF calculation.
See order of operations below when combined with multiple drop parameters.
drop_valuation: str or list of str (default = None)
Drops specific valuation periods. str must be date convertible.
Drops the link ratios whose starting value has the given valuation.
str must be date convertible. Each link ratio is keyed to the
valuation of its starting value, as in ``link_ratio``, so the latest
valuation of a triangle has no link ratios to drop. To leave out a
change that happened between valuations t-1 and t, pass t-1.
See order of operations below when combined with multiple drop parameters.
fillna: float, (default = None)
Used to fill in zero or nan values of an triangle with some non-zero
Expand All @@ -90,7 +94,7 @@ class Development(DevelopmentBase):

1. ``n_periods`` — limit to the most recent origin periods.
2. ``drop`` — remove specific origin/development cells.
3. ``drop_valuation`` — remove entire valuation diagonal in the triangle.
3. ``drop_valuation`` — remove the link ratios that start on the given valuations.
4. ``drop_high`` / ``drop_low`` — remove highest/lowest link ratios by rank
(eligible factors from ``n_periods`` are used; protected by ``preserve``,
which may relax exclusions from this step if too few ratios would remain then this step is skipped).
Expand Down Expand Up @@ -185,6 +189,32 @@ class Development(DevelopmentBase):
12-24 24-36 36-48 48-60 60-72 72-84 84-96 96-108 108-120 120-132
(All) 1.582216 1.339353 1.193406 1.095906 1.076968 1.033612 1.019016 0.997636 0.992918 0.999179

``drop_valuation`` keys each link ratio to the valuation of its starting
value, the same valuation ``link_ratio`` shows. Passing "1986" drops the
six link ratios that start on the 1986 valuation, one for each origin from
1981 to 1986.

.. testcode::

raa = cl.load_sample("raa")
print(cl.Development(drop_valuation="1986").fit_transform(raa).link_ratio)

.. testoutput::

12-24 24-36 36-48 48-60 60-72 72-84 84-96 96-108 108-120
1981 1.649840 1.319023 1.082332 1.146887 1.195140 NaN 1.033261 1.002902 1.009217
1982 40.424528 1.259277 1.976649 1.292143 NaN 0.993397 1.043431 1.033088 NaN
1983 2.636950 1.542816 1.163483 NaN 1.185695 1.029216 1.026374 NaN NaN
1984 2.043324 1.364431 NaN 1.101524 1.113469 1.037726 NaN NaN NaN
1985 8.759158 NaN 1.399912 1.170779 1.008669 NaN NaN NaN NaN
1986 NaN 1.815671 1.105367 1.225512 NaN NaN NaN NaN NaN
1987 7.217235 2.722886 1.124977 NaN NaN NaN NaN NaN NaN
1988 5.142117 1.887433 NaN NaN NaN NaN NaN NaN NaN
1989 1.721992 NaN NaN NaN NaN NaN NaN NaN NaN

To leave out a change that happened between valuations t-1 and t, pass
t-1: "1986" removes every link ratio that ends on the 1987 valuation.

We can also drop all link ratio(s) above the given parameter by passing a list of floats to the drop_above parameter.
Let's inspect the link ratios after the drop.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@
"source": [
"## Discarding Problematic Link Ratios\n",
"\n",
"Even with `n_periods`, there are situations where you might want to be more surgical in our selections. For example, you could have a valuation period with bad data and wish to omit the entire diagonal from your averaging."
"Even with `n_periods`, there are situations where you might want to be more surgical in our selections. For example, you could have a diagonal with bad data and wish to omit its link ratios from your averaging. `drop_valuation` drops the link ratios that start on the valuation you pass, so to leave out a change between valuations t-1 and t, pass t-1."
]
},
{
Expand Down
Loading