ClarkLDF#

class chainladder.ClarkLDF(growth: str = 'loglogistic', groupby=None)[source]#

An Estimator that allows for curve fitting development patterns according to Clark 2003.

The method fits incremental triangle amounts to one of “loglogistic” or “weibull” growth curves. Both of Clark’s methods, LDF and Cape Cod, can be estimated. To invoke the Cape Cod method, include “sample_weight” in when fitting the estimator.

Parameters:
growth: {‘loglogistic’, ‘weibull’}

The growth function to be used in curve fitting development patterns. Options are ‘loglogistic’ and ‘weibull’

groupby:

An option to group levels of the triangle index together for the purposes of estimating patterns. If omitted, each level of the triangle index will receive its own patterns.

Attributes:
ldf_: Triangle

The estimated loss development patterns.

cdf_: Triangle

The estimated cumulative development patterns.

incremental_fits_: Triangle

The fitted incrementals of the model.

theta_: DataFrame

Estimates of the theta parameter of the growth curve.

omega_: DataFrame

Estimates of the omega parameter of the growth curve.

elr_: DataFrame

The Expected Loss Ratio parameter. This only exists when a sample_weight is provided to the Estimator.

scale_: DataFrame

The scale parameter of the model.

norm_resid_: Triangle

The “Normalized” Residuals of the model according to Clark.

Examples

An actuary fitting Clark’s method must choose between the two growth curve families. Within the triangle the two curves often fit similar development patterns, but the loglogistic curve carries a heavier tail, so the choice drives how much development the model projects beyond the observed data. Fitting both curves to the same triangle and comparing the full fitted pattern, along with the percent of ultimate each curve implies has emerged at a mature age (here, 240 months), shows how much of the estimate rides on the curve selection.

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(np.round(m_log.ldf_.values[0, 0, 0, :], 3))
print(np.round(m_wei.ldf_.values[0, 0, 0, :], 3))
print(float(np.round(m_log.G_(240.0).values[0, 0, 0, 0], 3)))
print(float(np.round(m_wei.G_(240.0).values[0, 0, 0, 0], 3)))
[1.917 1.268 1.141 1.089 1.063 1.047]
[1.912 1.276 1.143 1.087 1.058 1.04 ]
0.85
0.993

The in-triangle factors are nearly identical, but the curves disagree about the tail: the loglogistic fit implies only 85% of ultimate has emerged by 240 months versus more than 99% for the weibull fit. The actuary should validate the implied tail against other benchmarks before relying on either curve.

To use Clark’s Cape Cod method instead of the LDF method, pass a premium vector as sample_weight when fitting. No other parameters are needed. The fitted estimator records the method in method_ and exposes the fitted expected loss ratios in elr_.

clrd = cl.load_sample("clrd").groupby("LOB").sum()
m = cl.ClarkLDF().fit(
    clrd["CumPaidLoss"],
    sample_weight=clrd["EarnedPremDIR"].latest_diagonal,
)
print(m.method_)
print(m.elr_.round(3))
cape_cod
          CumPaidLoss
LOB
comauto         0.680
medmal          0.701
othliab         0.624
ppauto          0.826
prodliab        0.671
wkcomp          0.698

The clrd sample holds 775 company-level triangles, and most individual companies are too small to support their own curve fit. Rather than running a separate optimization on each thin triangle, the actuary can pass groupby to pool the companies into one fit per line of business, producing a single (omega_, theta_) parameter pair for each LOB.

clrd = cl.load_sample("clrd")[["CumPaidLoss"]]
print(len(clrd.index))
m = cl.ClarkLDF(groupby="LOB").fit(clrd)
print(m.omega_.round(3))
print(m.theta_.round(3))
775
          CumPaidLoss
LOB
comauto         1.082
medmal          1.889
othliab         1.468
ppauto          1.149
prodliab        1.441
wkcomp          1.107
          CumPaidLoss
LOB
comauto        20.481
medmal         35.128
othliab        37.745
ppauto         10.023
prodliab       64.352
wkcomp         20.111
G_(age)[source]#

Growth function of the estimator.

Parameters:
ageint, float or array

The age(s) at which to compute the value of the growth curve.

Returns:
Triangle

A Triangle object with growth curve values

fit(X, y=None, sample_weight=None)[source]#

Fit the model with X.

Parameters:
XTriangle-like

Set of LDFs to which the munich adjustment will be applied.

yIgnored
sample_weightTriangle-like

Exposure vector used to invoke the Cape Cod method.

Returns:
selfobject

Returns the instance itself.

transform(X)[source]#

If X and self are of different shapes, align self to X, else return self.

Parameters:
XTriangle

The triangle to be transformed

Returns:
X_newNew triangle with transformed attributes.

Inherited Methods

ClarkLDF.fit_transform

Fit to data, then transform it.

ClarkLDF.get_metadata_routing

Get metadata routing of this object.

ClarkLDF.get_params

Get parameters for this estimator.

ClarkLDF.pipe

Apply func(self, *args, **kwargs).

ClarkLDF.set_backend

Converts triangle array_backend.

ClarkLDF.set_output

Set output container.

ClarkLDF.set_params

Set the parameters of this estimator.

ClarkLDF.to_json

Serializes triangle object to json format

ClarkLDF.to_pickle

Serializes triangle object to pickle.