chainladder.Chainladder

Contents

chainladder.Chainladder#

class chainladder.Chainladder[source]#

The basic deterministic chainladder method.

Parameters:
None
Attributes:
X_:

returns X used to fit the triangle

ultimate_:

The ultimate losses per the method

ibnr_:

The IBNR per the method

full_expectation_:

The ultimates back-filled to each development period in X replacing the known data

full_triangle_:

The ultimates back-filled to each development period in X retaining the known data

Methods

fit(X[, y, sample_weight])

Fit the model with X.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

intersection(a, b)

Given two Triangles with mismatched indices, this method aligns their indices

predict(X[, sample_weight])

Predicts the chainladder ultimate on a new triangle X

set_backend(backend[, inplace, deep])

Converts triangle array_backend.

set_fit_request(*[, sample_weight])

Configure whether metadata should be requested to be passed to the fit method.

set_params(**params)

Set the parameters of this estimator.

set_predict_request(*[, sample_weight])

Configure whether metadata should be requested to be passed to the predict method.

to_json()

Serializes triangle object to json format

to_pickle(path[, protocol])

Serializes triangle object to pickle.

fit_predict

pipe

validate_X

validate_weight

Examples

Fit the chainladder method to a loss triangle and inspect the projected ultimates.

tr = cl.load_sample('ukmotor')
model = cl.Chainladder().fit(tr)
print(model.ultimate_)
              2261
2007  12690.000000
2008  13096.902024
2009  14030.536767
2010  13137.859861
2011  13880.404483
2012  16812.150646
2013  20679.919151

The ibnr_ attribute is ultimate_ - latest_diagonal. The 2007 origin is fully developed in the data, so its IBNR is NaN.

print(model.ibnr_)
              2261
2007           NaN
2008    350.902024
2009   1037.536767
2010   2044.859861
2011   3663.404483
2012   7162.150646
2013  14396.919151

full_triangle_ projects each origin to ultimate while preserving the known cells. Showing the last three origins and the first five development periods makes the data-to-projection boundary visible: whole-number cells are observed, decimal cells are projected.

print(model.full_triangle_.iloc[..., -3:, :5])
          12            24            36            48            60
2011  4150.0   7897.000000  10217.000000  11719.970266  12853.969769
2012  5102.0   9650.000000  12374.981102  14195.400857  15568.917781
2013  6283.0  11870.058983  15221.943585  17461.165333  19150.670711

full_expectation_ is similar but replaces every cell, including the known ones, with the model’s expectation. Compare the 12 column above against the same slice below: the observed values have been overwritten.

print(model.full_expectation_.iloc[..., -3:, :5])
               12            24            36            48            60
2011  4217.162588   7967.208127  10217.000000  11719.970266  12853.969769
2012  5107.889530   9650.000000  12374.981102  14195.400857  15568.917781
2013  6283.000000  11870.058983  15221.943585  17461.165333  19150.670711