diff --git a/chainladder/development/clark.py b/chainladder/development/clark.py index f8e1db17..269e9016 100644 --- a/chainladder/development/clark.py +++ b/chainladder/development/clark.py @@ -54,6 +54,61 @@ class ClarkLDF(DevelopmentBase): norm_resid_: Triangle The "Normalized" Residuals of the model according to Clark. + Examples + -------- + Compare curve families when the selected growth curve materially affects + the fitted development pattern. The same triangle can be fit with the + default loglogistic curve or with the Weibull curve. + + .. testsetup:: + + import chainladder as cl + + .. testcode:: + + import numpy as np + + tri = cl.load_sample("ukmotor") + m_log = cl.ClarkLDF(growth="loglogistic").fit(tri) + m_wei = cl.ClarkLDF(growth="weibull").fit(tri) + print(float(np.round(m_log.ldf_.values[0, 0, 0, 0], 3))) + print(float(np.round(m_wei.ldf_.values[0, 0, 0, 0], 3))) + + .. testoutput:: + + 1.917 + 1.912 + + Provide exposure when the goal is a Cape Cod fit rather than a pure LDF + fit. Passing ``sample_weight`` changes ``method_`` to ``cape_cod`` and + estimates ``elr_``. + + .. testcode:: + + tri = cl.load_sample("ukmotor") + m = cl.ClarkLDF().fit(tri, sample_weight=tri * 0 + 1e7) + print(m.method_) + print(float(np.round(m.elr_.values[0, 0], 6))) + + .. testoutput:: + + cape_cod + 0.002002 + + Pool similar segments before fitting when each individual triangle is too + sparse for separate curve parameters. Here line of business produces one + parameter set per ``LOB``. + + .. testcode:: + + clrd = cl.load_sample("clrd").groupby("LOB")[["IncurLoss"]].sum() + m = cl.ClarkLDF(groupby="LOB").fit(clrd) + print(m.theta_.shape) + + .. testoutput:: + + (6, 1) + """ def __init__(