Selecting BornhuetterFerguson Apriori

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)
Hide 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');
../_images/fc07d010d2ef7aea15ea850bb6bf404a9a2a7cc6caa1248c03a1572b1d534c78.png