Extrapolation Period Sensitivity#
import chainladder as cl
This example demonstrates the extrap_periods functionality of the TailCurve
estimator. The estimator defaults to extrapolating out 100 periods. However,
we can see that the “Inverse Power” curve fit doesn’t converge to its asymptotic
value.
tri = cl.load_sample('clrd').groupby('LOB').sum().loc['medmal', 'CumPaidLoss']
# Create a function to grab the scalar tail value.
def scoring(model):
""" Scoring functions must return a scalar """
return model.tail_.iloc[0, 0]
# Create a grid of scenarios
param_grid = dict(
extrap_periods=list(range(1, 100, 6)),
curve=['inverse_power', 'exponential'])
# Fit Grid
model = cl.GridSearch(cl.TailCurve(), param_grid=param_grid, scoring=scoring).fit(tri)
# Plot results
results = model.results_.pivot(columns='curve', index='extrap_periods', values='score')