MackChainladder#
- class chainladder.MackChainladder[source]#
Basic stochastic chainladder method popularized by Thomas Mack
- Parameters:
- None
- Attributes:
- X_:
returns X
- 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
- summary_:
summary of the model
- full_std_err_:
The full standard error
- total_process_risk_:
The total process error
- total_parameter_risk_:
The total parameter error
- mack_std_err_:
The total prediction error by origin period
- total_mack_std_err_:
The total prediction error across all origin periods
Examples
Use
MackChainladderwhen the IBNR point estimate alone is not sufficient and a measure of reserve uncertainty is also needed.summary_shows the deterministic chainladder ultimate alongside Mack’s per-origin prediction error.tr = cl.load_sample('ukmotor') model = cl.MackChainladder().fit(tr) print(model.summary_)
Latest IBNR Ultimate Mack Std Err 2007 12690.0 NaN 12690.000000 NaN 2008 12746.0 350.902024 13096.902024 27.246756 2009 12993.0 1037.536767 14030.536767 36.524408 2010 11093.0 2044.859861 13137.859861 144.534287 2011 10217.0 3663.404483 13880.404483 427.634355 2012 9650.0 7162.150646 16812.150646 693.166178 2013 6283.0 14396.919151 20679.919151 901.408385
total_mack_std_err_aggregates the prediction error across all origins. It exceeds the quadrature sum of the per-origin errors insummary_because parameter risk is correlated across origins: all origins share the same estimated age-to-age factors.print(model.total_mack_std_err_)
columns values (Total,) 1424.531543
The Mack standard error is sensitive to how the upstream development factors were estimated. Using simple (unweighted) averaging in
Developmentbefore fittingMackChainladdergives equal weight to each accident year regardless of size. On a small triangle this raises the aggregate standard error relative to volume weighting, since thinner years contribute more uncertainty.tr = cl.load_sample("ukmotor") tr_simple = cl.Development(average="simple").fit_transform(tr) print(cl.MackChainladder().fit(tr_simple).total_mack_std_err_)
columns values (Total,) 1591.603339
- fit(X, y=None, sample_weight=None)[source]#
Fit the model with X.
- Parameters:
- X: Triangle-like
Data to which the model will be applied.
- y: Ignored
- sample_weight: Ignored
- Returns:
- self: object
Returns the instance itself.
Examples
After fitting,
ibnr_holds the point estimate per origin andmack_std_err_holds the prediction error. The ratio of the two gives a coefficient of variation that shows which origins carry the most reserve uncertainty relative to their size.import numpy as np import pandas as pd tr = cl.load_sample('ukmotor') model = cl.MackChainladder().fit(tr) df = model.ibnr_.to_frame(origin_as_datetime=False).round(1) df.columns = ["IBNR"] df["Mack Std Err"] = np.round( model.mack_std_err_.values[0, 0, :, -1], 1 ) print(df)
IBNR Mack Std Err 2007 NaN NaN 2008 350.9 27.2 2009 1037.5 36.5 2010 2044.9 144.5 2011 3663.4 427.6 2012 7162.2 693.2 2013 14396.9 901.4
- predict(X, sample_weight=None)[source]#
Predicts the Mack chainladder ultimate on a new triangle X.
The fitted age-to-age factors and sigma estimates from
self.X_are applied toXto computeultimate_and the Mack standard errors (parameter risk, process risk,mack_std_err_,total_mack_std_err_) on the predicted Triangle.- Parameters:
- X: Triangle
Loss data to which the fitted model will be applied. Must share the same shape as the Triangle used in
fit().- sample_weight: Triangle
Optional exposure used in CDF alignment.
- Returns:
- X_new: Triangle
Triangle with
ultimate_and Mack std error attributes attached.
Examples
predictre-applies the fitted age-to-age factors and sigma estimates to a new triangle without refitting. A common use is sensitivity testing: hold the development pattern fixed and scale the reported losses by an adverse factor to see how the Mack standard error responds. Under Mack (1993), the prediction error scales approximately proportionally with the reserve level because sigma is estimated from the original fit and held fixed; applying the factors to a uniformly scaled triangle would give exactly proportional results, but scaling only the reported diagonal (as below) gives a slightly smaller increase.tr = cl.load_sample('ukmotor') model = cl.MackChainladder().fit(tr) tr_adverse = tr * 1.05 print(model.predict(tr).total_mack_std_err_) print(model.predict(tr_adverse).total_mack_std_err_)
columns values (Total,) 1424.531543 columns values (Total,) 1475.539173
Inherited Methods
|
|
|
Get metadata routing of this object. |
|
Get parameters for this estimator. |
|
Given two Triangles with mismatched indices, this method aligns their indices |
|
Apply |
|
Converts triangle array_backend. |
|
Set the parameters of this estimator. |
|
Serializes triangle object to json format |
|
Serializes triangle object to pickle. |
|
|
|