# Calculating claims reserve using Python

In this article, I will walk you through a step by step guide on how you can save tremendous time in calculating claims reserve using the chain ladder library in python. But first things first, and let us get some definitions out of the way.

**What is a claims reserve?**

A claims reserve is money set aside by an insurance company to pay legitimate filed or expected to be filed claims. Insurers use these reserve amounts to pay out incurred claims that have yet to be settled.

The outstanding claims reserve is an actuarial estimate as the amounts liable on any given claim is not known until settlement.

In our case, we only have paid claims, so we will use the paid claims amount to predict the total claims reserve estimate for an insurer that writes three classes of business Motor, Fire and Micro Insurance.

**2.0. Data Preprocessing**

We first need to load the required libraries and the claims data set that we will use to perform our claims reserving exercise. Follow this link to use the same data set I used.

Great!. Since our data looks good and has already been cleaned, no further action is required in data preprocessing. However, depending on the type of data you have, you may have to do the dirty work until you have something similar to Figure 3: above.

# 3.0. Feature engineering

Next, we map our dataset to predefined features of the chainladder triangle object for triangulation.

The beauty of the chain ladder library is that it does all the heavy lifting for you, and we can now visualise the incremental triangles for the three lines of business with the following code.

The next step is to use the inc_to_cum() chainladder function and construct cumulative paid loss triangles.

**3.0. Exploratory Data Analysis**

Now that we have our cumulative triangles, we perform exploratory data analysis to understand more about our data.

We’ll start by plotting the cumulative paid loss triangles and explore the evolution of cumulative claims payment per loss year.

Next, we will go further and explore the age-to-age factors

At this point, you may want to investigate why specific periods have a higher development factor than others.

You can use the cl.Development() function to drop development factors and the cl.DevelopmentConstant() function to manually updated development patterns.

**4.0 Actuarial Modeling**

**Independence test at 95% confidence**

The multiplicative chainladder method is based on the strong assumptions of independence across origin years and across valuation years. Mack developed tests to verify these assumptions, and false indicates that the correlation between years is not sufficiently large.

**Mack’s test for the calendar year effect**

A calendar period has an impact across developments if the probability of the number of small (or large) development factors in that period occurring randomly is less than p_critical

**Mack’s test for correlations between subsequent development factors.**

Results should be within the confidence interval range otherwise too much correlation.

From our tests above, our data satisfactorily satisfy the independence test, and thus the chainladder method would be an ideal fit for predicting claims reserve.

**Applying the basic chainladder technique**

The classical chain ladder is a deterministic algorithm to forecast claims based on historical data.

Often it is not suitable to assume that the oldest origin year is fully developed. Ultimates are measured at a valuation date way into the future. The library is extraordinarily conservative in picking this date and sets it to December 31, 2261. This is set globally and can be viewed by referencing the ULT_VAL constant.

Generate summary results

**5.0 Conclusion**

Python is a very powerful tool to help with the day to day computation of actuarial reserve estimates. It can handle large data sets and tremendously improve the time to generate reserving outputs, leaving you with more time to explore results and improve the claims reserving process.

Thank you for the read. I am open to constructive feedback. Drop me an email at nm@nmisawo.com.

You can find me on LinkedIn.