Skip to content
Open
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
23 changes: 23 additions & 0 deletions chainladder/tails/bondy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ class TailBondy(TailBase):
--------
TailCurve

Examples
--------
Start the Bondy fit later when earlier link ratios are too volatile for the
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is an instructive example. please elaborate

selected tail. The fitted exponent changes because fewer ages enter the
tail regression.

.. testsetup::

import chainladder as cl

.. testcode::

dev = cl.Development().fit_transform(cl.load_sample("raa"))
b_def = cl.TailBondy().fit(dev)
b_12 = cl.TailBondy(earliest_age=12).fit(dev)
print(round(float(b_def.b_.iloc[0, 0]), 6))
print(round(float(b_12.b_.iloc[0, 0]), 6))

.. testoutput::

0.5
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

are these two results too close to demonstrate the theoretical knowledge offer by the setup of the example?

0.48451

"""

def __init__(self, earliest_age=None, attachment_age=None, projection_period=12):
Expand Down
23 changes: 23 additions & 0 deletions chainladder/tails/clark.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@ class TailClark(TailBase):
norm_resid_: Triangle
The "Normalized" Residuals of the model according to Clark.

Examples
--------
Compare Clark growth curves when the selected tail shape is part of the
modeling judgment. The tail LDF changes because each curve extrapolates the
remaining development differently.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

these sentences are tautologies (i.e. output changes because input is different), which are not instructive. can we explain why one is much higher than the other, rather than just observing that they are in fact different?


.. testsetup::

import chainladder as cl

.. testcode::

dev = cl.Development().fit_transform(cl.load_sample("raa"))
log = cl.TailClark(growth="loglogistic").fit(dev)
wei = cl.TailClark(growth="weibull").fit(dev)
print(round(float(log.ldf_.values[0, 0, 0, -1]), 3))
print(round(float(wei.ldf_.values[0, 0, 0, -1]), 3))

.. testoutput::

1.189
1.014

"""

def __init__(self, growth="loglogistic", truncation_age=None,
Expand Down
25 changes: 25 additions & 0 deletions chainladder/tails/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ class TailCurve(TailBase):
Slope parameter of the curve fit.
intercept : DataFrame
Intercept parameter of the curve fit.

Examples
--------
Compare parametric tail curves when the same development pattern can
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

when should someone use exponential? when should someone use power? what should they use to evaluate the fit?

support multiple extrapolation shapes. The last-period LDF reflects the
selected curve family.

.. testsetup::

import chainladder as cl

.. testcode::

tri = cl.load_sample("tail_sample")
dev = cl.Development().fit_transform(tri)
exp = cl.TailCurve(curve="exponential", extrap_periods=5).fit(dev)
inv = cl.TailCurve(curve="inverse_power", extrap_periods=5).fit(dev)
print(round(float(exp.ldf_.values[0, 0, 0, -1]), 6))
print(round(float(inv.ldf_.values[0, 0, 0, -1]), 6))

.. testoutput::

1.0093
1.039271

"""

def __init__(
Expand Down
Loading