Selecting BornhuetterFerguson Apriori#
import chainladder as cl
import pandas as pd
This example demonstrates how you can can use the output of one method as the apriori selection for the Bornhuetter-Ferguson Method.
We use basic arithmetic to build up an Apriori rather than initializing it explicitely with cl.Triangle
# Create Aprioris as the mean AY chainladder ultimate
raa = cl.load_sample('RAA')
cl_ult = cl.Chainladder().fit(raa).ultimate_ # Chainladder Ultimate
apriori = cl_ult * 0 + (cl_ult.sum() / 10) # Mean Chainladder Ultimate
bf_ult = cl.BornhuetterFerguson(apriori=1).fit(raa, sample_weight=apriori).ultimate_
output = pd.concat(
(cl_ult.to_frame().rename({'2261': 'Chainladder'}, axis=1),
bf_ult.to_frame().rename({'2261': 'BornhuetterFerguson'}, axis=1)),
axis=1)
Show code cell source
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%config InlineBackend.figure_format = 'retina'
# Plot of Ultimates
ax = output.plot(grid=True, marker='o',
xlabel='Accident Year', ylabel='Ultimate');