Industry publications – Sigma/Lloyd’s

Some of my favorite reading on insurance related topics comes from Swiss Re‘s Sigma series and Lloyd’s of London’s emerging risk teams. 

The latest Swiss Re Sigma publication covers the CAT events of 2018, which were driven mainly by “secondary perils”:

The Lloyd’s of London reports cover the impacts of AI on insurance and the risks of robotics:

Some interesting new articles

– An excellent tutorial article by Jürg Schelldorfer and Mario Wüthrich showing how to apply a hybrid GLM/neural net for pricing. The paper is here:

– This paper uses a recurrent neural network (LSTM) to forecast the time parameters of a Lee-Carter model, and the results look very promising – much better than using an ARIMA model:

– Lastly, this paper proposes an interesting combination of a decision tree model with Bühlmann-Straub credibility:

Great to see the state of the art being advanced on so many fronts!

Neural networks, the Lee-Carter Model and Large Scale Mortality  Forecasting

This post discusses a new paper that I am very glad to have co-authored with Mario Wüthrich, in which we apply deep neural networks to mortality forecasting. The draft can be found here:


A topic that I have been interested in for a long time is forecasting mortality rates, perhaps because this is one of the interesting intersections of statistics and these days, machine learning, and the field of actuarial science in life insurance. Several methods to model mortality rates over time have been proposed, ranging from the relatively simple method of extrapolating mortality rates directly using time series, to more complicated statistical approaches.

One of the most famous of these is the Lee-Carter method, which models mortality as an average mortality rate that changes over time. The change over time is governed by a time-based mortality index, which is common to all ages, and an age-specific rate of change factor:

ln(mx,t )=ax +kt .bx

where mx,t is the force of mortality at age x in year t, ax is average log mortality rate during the period at age x, κt is the time index in year in year t and bx is the rate of change of log mortality with respect to the time index at age x.

How are these quantities derived? There are two methods prominent in the literature – applying Principal Components Analysis, or Generalized Non-linear Models, which are different from GLMs in the sense that the user can specify non-additive relationship between two or more terms. To forecast mortality, models are first fit to historical mortality data and the coefficients (in the case of the Lee- Carter model, the vector κ) are then forecast using a time series model, in a second step.

In the current age of big data, relatively high quality mortality data spanning an extended period are available for many countries from the excellent Human Mortality Database, which is a resource that anyone with an interest in the study of mortality can benefit from. Other interesting sources are databases containing sub-national rates for the USA, Japan and Canada. The challenge, though, is how to model all of these data simultaneously to improve mortality forecasts? While some extensions of basic models like the Lee-Carter model have been proposed, these rely on assumptions that might not necessarily be applicable in the case of large scale mortality forecasting. For example, some of the common multi-population mortality models rely on the assumption of a common mortality trend for all countries, which is likely not the case.

In the paper, we tackle this problem in a novel way – feed all the variables to a deep neural network and let it figure out how exactly to model the mortality rates over time. This speaks to the idea of representation learning that is central to modern deep learning, which is that many datasets, such as large collections of images as in the ImageNet dataset, are too complicated to model by hand-engineering features, or it is too time consuming to perform the modelling. Rather, the strategy in deep learning is to define a neural network architecture that expresses useful priors about the data, and allow the network to learn how the raw data relates to the problem at hand. In the example of modelling mortality rates, we use two architectural elements that are common in applications of neural networks to tabular data:

  • We use a deep network, in other words the network consists of multiple layers of variables that expresses the prior that complex features can be represented by a hierarchy of simpler representations learned in the model.
  • Instead of using one-hot encoding to signify to the network when we are modelling a particular country, or gender, we use embedding layers. When applied to many categories, one-hot encoding produces a high-dimensional feature vector that is sparse (i.e. many of the entries are zero), leading to potential difficulties in fitting a model as there might not be enough data to derive credible estimates for each category. Even if there is enough data, as in our case of mortality rates, each parameter is learned in isolation, and the estimated parameters do not share information, unless the modeller explicitly chooses to use something like credibility or mixed models. The insight of Bengio et al. (2003) to solve these problems is that categorical data can successfully be encoded into low dimensional, dense numerical vectors, so, for example, in our model, country is encoded into a five-dimensional vector.

In the paper, we also show how the original Lee-Carter model can be expressed as a neural network with embeddings!

Here is a picture of the network we have just described:

In the paper, we also employ one of the most interesting techniques to emerge from the computer vision literature in the past several years. The original insight is due to the authors of the ResNet paper, who analysed the well-known problem that it is often difficult to train deep neural networks. They considered that a deep neural network should be no more difficult to train than a shallow network, since the deeper layers could simply learn the identity function, and thus be equivalent to a shallow network. Without going too far off track into these details, their solution is simple – add skip layers that connect the deep layers to more shallow layers in the network. This idea is expanded on in the DenseNet architectures. We simply added a connection between the feature layer, and the fifth layer of the network, connecting the embedding layers almost to the deepest layer of the network. This boosted the performance of the networks considerably.

We found that the deep neural networks dramatically outperformed the competing methods that we tested, forecasting with the lowest MSE in 51 out of the 76 instances we tested! Here is a table comparing the methods, and see the paper for more details:

Lastly, an interesting property of the embedding layers learned by neural networks is the fact that the parameters of these layers are often interpretable as so-called “relativities” (to use some actuarial jargon), in other words, as defining the relationship between the different values that a variable may take.  Here is a picture of the age embedding, which shows that the main relationship learned by the network is the characteristic shape of a modern life table:

This is a rather striking result, since at no time did we specify this to the network! Also, once the architecture was specified, the network has also learned to forecast mortality rates more successfully than human specified models reminding me of one of the desiderata for AI systems listed by Bengio (2009):

“Ability to learn with little human input the low-level, intermediate, and high-level abstractions that would be useful to represent the kind of complex functions needed for AI tasks.”

We would value any feedback on the paper you might have.


Bengio, Y. 2009. “Learning deep architectures for AI”, Foundations and trends® in Machine Learning 2(1):1-127.

AI in Actuarial Science – #ASSA2018

I will be speaking about deep learning and its applications to actuarial work at the 2018 ASSA Convention in Cape Town, this Thursday 25 October. Hope to see you there!

Here are:

  • the slides of the talk:

AI in Act Sci – slides

  • accompanying paper:


  • code to reproduce some of the results:



Thoughts on writing “AI in Actuarial Science”

This is a follow up post to something I wrote a few months ago, on the topic of AI in Actuarial Science. Over the intervening time, I have been writing a paper for the ASSA 2018 Convention in Cape Town on this topic, a draft of which can be found here:

and code here:

I would value feedback on the paper from anyone who has time to read the paper.

This post, though, is about the process of writing the paper and some of the issues I encountered. Within the confines of an academic paper it is often hard, and perhaps mostly irrelevant, to express some thoughts and opinions and in this blog post I hope to share some of these ideas that did not make it into the paper. I am not going to spend much time defining the terms too much, and if you refer to the paper if some terminology is unclear I think it will help to clarify.

Vanilla ML techniques might not work

Within the paper I try to apply deep learning to the problem addressed in the excellent tutorial paper of Noll, Salzmann and Wüthrich (2018) which is about applying machine learning techniques to a French Motor 3rd Party Liability (MTPL) dataset. They achieve some nice performance boosts over a basic GLM with some hand engineered features using a boosted tree and a neural network.

One of the biggest shocks that I had was when I decided to try this problem myself is that off the shelf tools like XGboost did not work well at all – in fact, the GLM was by far better despite the many hyper-parameter settings that I tried. I also tried out the mboost package but the dataset was too big for the 16gb of RAM on my laptop.

So the first mini-conclusion is that just because you have tabular data (i.e. structured data with rows for observations and columns for variables, like in SQL), you should not automatically assume that a fancy ML approach is going to outperform a basic statistical one. Anecdotally, I am hearing from several different people that applying vanilla techniques to pricing problems doesn’t provide much performance boost.

To this point, I recommend Frank Harell’s excellent blog post on ML versus statistical techniques, and about when to apply which:

Vanilla DL techniques might not work either

This was perhaps the most vexing part of the process. Fitting deep networks with ReLu activations to the French dataset, like the more up to date sources on deep learning seem suggest, also did not work all that well! In fact, I achieved only poor performance on a network fit to data without manual feature engineering. Another issue is that depth didn’t seem to help all that much.

Similarly, naively coding up deep autoencoders for the mortality data that is also discussed in the paper turned out to be a major learning when writing the paper – these just did not converge despite the many attempts at tuning the hyperparameters. I only managed to find a decent solution using greedy unsupervised learning (Hinton and Salakhutdinov 2006) of autoencoder layers.

Therefore a conclusion if you encounter a problem to which you want to apply Deep Learning – be aware that ReLus plus depth might not work and you might need to dig into the literature a bit!

When DL works, it really works!

This is connected to the next idea. Once I found a way of training the autoencoders, the results were fantastic and by far exceeded my expectations (and the performance of the Lee-Carter benchmark for mortality forecasting). Also, once I had the embedding layers working on the French MTPL dataset, the results were better than any other technique I could (or can) find. I was also impressed by the intuitive meaning of the learned embeddings, which I discuss in some detail in the paper, and the fact that plugging these embeddings back into the vanilla GLM resulted in a substantial performance boost.

The flexibility of the neural networks that can be fit with modern software, like Keras, is almost unlimited. Below is what I call a “learned exposure” network which has a sub-network to learn an optimal exposure measure for each MTPL policy. I have not encountered a similarly flexible and powerful system in any other field of statistics or machine learning.

Is this really AI?

One potential criticism of the title of the paper is that this isn’t really AI, but rather fancy regression modelling. I try to argue in Section 3 of the paper that Deep Learning is an approach to Machine Learning whereby you allow the algorithm to figure out the features that are important (instead of designing them by hand).

This is one of the desiderata for AI listed by Bengio (2009) on page 10 of that work – “Ability to learn with little human input the low-level, intermediate, and high-level abstractions that would be useful to represent the kind of complex functions needed for AI tasks.”

Do I think that my trained Keras models are AI? Absolutely not. But, the fact that the mortality model has figured out the shape of a life table (i.e. the function ax in the Lee-Carter model) without any inputs besides for year/age/gender/region and target mortality rates should make us pause to think about the meaningful features captured by deep neural nets. Here is the relevant plot from the paper – consider “dim1”:

This gets even more interesting in NLP applications, such as in Mikolov, Sutskever, Chen et al. (2013) who provide this image which shows that their deep network has captured the semantic meaning of English words:

Also, that deep nets seem to be able to perform “AI tasks” (the term used by Bengio, Courville and Vincent (2013) to mean tasks “which are challenging for current (shallow, my addition) machine learning algorithms, and involve complex but highly structured dependencies”) such as describing images indicates that something more than simple regression is happening in these models.

DL is empirical, not yet scientific

An in joke that seems to have made the rounds is so-called “gradient descent by grad student” – in other words, it is difficult to find optimal deep learning models and one needs to fiddle around with designs and optimizers until something that works is found. This is much easier if you have a team of graduate students who can do this for you, thus the phrase quoted above. What this means in practice is that there is often no off the shelf solution, and little or no theory to guide you in what might work or not, leading to lots of experimenting with different ideas until the networks perform well.

AI in Actuarial Science is a new topic but there are some pioneers

The traditional actuarial literature has not seen many contributions dealing with deep neural networks, yet. Some of the best work I found, which I highly recommend to anyone interested in this topic, is a series of papers by Mario Wüthrich and his collaborators (Gabrielli and Wüthrich 2018; Gao, Meng and Wüthrich 2018; Gao and Wüthrich 2017; Noll, Salzmann and Wüthrich 2018; Wüthrich 2018a, b; Wüthrich and Buser 2018; Wüthrich 2017). What is great about these papers is that the ideas are put on a firm mathematical basis and discussed within the context of profound traditional actuarial knowledge. I have little doubt that once these ideas take hold within the mainstream of the actuarial profession, they will have a huge impact on the practical work performed by actuaries, as well as on the insurance industry.

Compared to statistical methods, though, there are still big gaps in understanding the parameter/model risk of these deep neural networks and an obvious next step is to try apply some of the techniques used for parameter risk of statistical models to deep nets.

The great resources available to learn about and apply ML and DL

There are many excellent resources available to learn about Machine and Deep Learning that I discuss in the resources sections of the paper, and, best of all, most of these are free, except for opportunity costs.

Lastly, a word about Keras , which is the high level API that makes fitting deep neural models easy. This is a phenomenally well put together package, and the R interface makes it much more accessible to actuaries who might not be familiar with Python. I highly recommend Keras to anyone interested in experimenting with these models, and, Keras will be able to handle most tasks thrown at it, as long as you don’t try anything too fancy. One thing I wanted to try, but couldn’t figure out was how to add an autoencoder layer to a supervised model where the inputs are the outputs of a previous layer, and this is one of the few examples where I ran into a limitation in Keras.


Bengio, Y. 2009. “Learning deep architectures for AI”, Foundations and trends® in Machine Learning 2(1):1-127.

Bengio, Y., A. Courville and P. Vincent. 2013. “Representation learning: A review and new perspectives”, IEEE transactions on pattern analysis and machine intelligence 35(8):1798-1828.

Gabrielli, A. and M. Wüthrich. 2018. “An Individual Claims History Simulation Machine”, Risks 6(2):29.

Gao, G., S. Meng and M. Wüthrich. 2018. Claims Frequency Modeling Using Telematics Car Driving Data. SSRN. Accessed: 29 June 2018.

Gao, G. and M. Wüthrich. 2017. Feature Extraction from Telematics Car Driving Heatmaps. SSRN. Accessed: June 29 2018.

Hinton, G. and R. Salakhutdinov. 2006. “Reducing the dimensionality of data with neural networks”, Science 313(5786):504-507.

Mikolov, T., I. Sutskever, K. Chen, G. Corrado et al. 2013. “Distributed representations of words and phrases and their compositionality,” Paper presented at Advances in neural information processing systems. 3111-3119.

Noll, A., R. Salzmann and M. Wüthrich. 2018. Case Study: French Motor Third-Party Liability Claims. SSRN. Accessed: 17 June 2018.

Wüthrich, M. 2018a. Neural networks applied to chain-ladder reserving. SSRN. Accessed: 1 July 2018.

Wüthrich, M. 2018b. v-a Heatmap Simulation Machine. Accessed: 1 July 2018.

Wüthrich, M. and C. Buser. 2018. Data analytics for non-life insurance pricing. Swiss Finance Institute Research Paper. Accessed: 17 June 2018.

Wüthrich, M.V. 2017. “Covariate selection from telematics car driving data”, European Actuarial Journal 7(1):89-108.


Thoughts on the International Congress of Actuaries 2018

I had to get a couple more CPD hours done and the ICA 2018 conference came along at exactly the right time! This time around, a virtual option was offered and the Actuarial Society of South Africa (ASSA) organized access for all of its members – a really great move by ASSA in my opinion, and I hope that others benefited as much as I did from this intellectually stimulating event.

I listened with a focus on P&C insurance (I prefer the American term, but in other jurisdictions: SA – short-term, UK – GI, Europe – non-Life), so my comments that follow don’t take account of the sessions on other actuarial areas that I have no doubt were also very worthwhile.

In a previous post I advanced the view that actuarial science is not standing still as a discipline, and that comments such as “AI instead of actuaries” are short-sighted. I am glad to report that the discipline is moving forward rapidly to incorporate machine learning and data science into its toolbox – of the 28 sessions I listened to (I needed a lot of CPD!), 9 mentioned machine learning/data science and had some advice on methods or integrating ML into actuarial practice. Another good sign is that some of the leading researchers speaking at the conference – such as Paul Embrechts and Mario Wüthrich – provided their (positive) thoughts on integrating ML and data science into actuarial science. The actuarial world is moving forward rapidly and I think the prospects for the profession are good, if the actuarial associations around the world recognize the trends quickly and incorporate ML/data science and more into the curricula.

My standout favourite session was by Mario Wüthrich (who some actuaries will recognize as one of the co-authors of the Merz-Wüthrich one year reserve risk formula), who presented on his paper “Neural networks applied to Chain-ladder reserving”, available on SSRN. Besides for the new method he suggests, which I think is one of the best solutions when an actuary needs to reserve for IBNR by sub-category (such as LOB/injury code etc), I found the perspectives on ML that he interspersed his talk with fascinating, an example of which is connecting neural networks to Hilbert’s 13th problem. One point made was that the new claims of algorithms potentially reserving with much less uncertainty than the chain-ladder need to be treated with caution until the issue of model risk is dealt with, and the underlying assumptions brought out into the open.

A brilliant session was given by Paul Glasserman on “Robust model risk assessment” (the paper is ungated if you google it). At the heart of the idea is that model risk could be defined as an alternative probability measure (i.e. if the model generates a baseline probability distribution on a random variable of interest, then model risk could arise if in fact the RV followed a different probability distribution) attached to the simulations presented by a stochastic model (instead of an issue with the model parameters or structure). With this idea in hand, the presentation carried on to show how to find the maximally damaging alternative probability measure for a given level of model risk, as measured by the relative entropy between the baseline and alternative models. The major benefit for actuaries is that this is simple to implement in practice and gives rise to some interesting insights into what can go wrong with a model.

Another session that stood out for me is Pietro Parodi and Peter Watson’s session ”Property Graphs: A Statistical Model for Fire Losses Based on Graph Theory”. The idea here is to find a model that helps to explain why commercial property follows the heavy tail severity distributions observed in practice. Often, in practice, algorithms/distributions are applied because they work and not because there is a good logical basis based on first principles. Along these lines, I am reminded of some of the work of Perks/Beard who proposed first principle models to explain their mortality laws (my small contribution along these lines is an explanation of the chain-ladder algorithm as a life-table estimator, on this blog). Parodi and Watson use graph theory to represent properties (houses/factories etc) and define statistical models on the graph of fire events. These models lead, after simulation and in aggregate, to curves defining the overall severity of a fire event that are not radically different from the current set of curves used by actuaries.

Paul Embrecht’s sessions were amazing to listen to, because of his ability to tie together so many disparate strands in actuarial science and quantitative risk management. It was particularly meaningful to see Paul, who is close to retirement, show-casing some of the work of Mario Wüthrich on telematics on stage, and providing his view that the novel application of data science, as embodied by the work on telematics, is a direction for the discipline to take.

I also enjoyed Hansjörg Albrecher’s session “Flood risk modelling” which was a tour-de-force of various statistical modelling techniques applied to some novel data.

Some other noteworthy sessions which spring to mind:

  • “Data based storm modelling” – this was a demonstration of how a storm model was built for Germany by a medium size consulting firm. I liked the application of mathematics (Delauney triangulation for mapping the wind events and Singular Value Decomposition for dimensionality reduction) to a relatively big data problem (40m records).
  • “Using Risk Factors in Insurance Analytics: Data Driven Strategies” – how to apply GLMs to sparse and high-dimensional data without breaking the linearity assumptions.
  • “Trend in Marine Insurance” – a great overview of this specialty line.

I am not sure if access to the VICA is still open, but if you have any interest in the topics above, I would strongly recommend you try and view some of the sessions.


Naked – South Africa’s Lemonade?

A start-up that I’ve been excited to watch for a while now – enigmatically called Naked – launched their product to market late last week. Naked offers car insurance over an app with quote and bind functionality. This post is going to discuss my thoughts on their offering, draw a parallel to the well-known Lemonade start-up in the USA and briefly touch on my experience with the app (spoiler – good price and fun experience).

The basis of Naked’s offering seems to be the following points:

  • The policy on offer is primarily Car insurance (Auto), plus a couple of extras (wheels, lights etc) over an app using a chatbot instead of traditional forms.
  • A neat feature is a pause in accident coverage when your car is stationary, leaving only the flood, theft, fire and other relevant perils on the policy.
  • They take a fixed fee upfront (20%) of premium to cover expenses and profit leaving the rest to cover claims
  • If claims are less than the 80% of premium written, then the extra portion is paid out to a charity of the policyholder’s choice
  • Policies are underwritten by Hollard, which is a big player in the SA insurance markets. Although not explicit on the website, I assume this means that if claims are more than the claims “pot”, then Hollard and the reinsurers on this product (Munich Re and Scor, according to the Naked website) need to pick up the bill
  • In a legal sense, Naked is an intermediary (broker) operating with what I assume is a binder agreement with Hollard, so actually, they could not bank the underwriting profit even if they wanted to

Anyone following the Insurtech scene will notice that this setup is very similar to Lemonade, which is a licensed insurer in the USA offering Renters and Homeowners insurance. Some of the similarities are using a chatbot instead of traditional forms, the fixed fee for expenses and profit, leaving a pot behind for claims, and the extra funds in the pot going to a charitable cause as a Giveback (Lemonade seems to have come up with this terminology). Some of the differences are that Lemonade is an insurance company and could participate in underwriting profit and loss if they wanted, Lemonade seems to have allowed themselves more discretion as to when they “Giveback” (Board needs to approve, they build up a rainy-day fund etc) and Lemonade pushed an emphasis on data science and behavioural economists, whereas Naked discusses their “AI” technology which they hope will bring down costs.

Using the app is a pleasant and short experience, with an emphasis on ease of use and quickly speeding you along the process. I was pleasantly surprised that the pricing is actually quite reasonable on the vehicle I chose to request a quote for (which is the same vehicle I tried to insure online a few weeks ago and discussed in this post).  To actually get the cover, one takes a few photos of your vehicle, and I wonder what exactly the process is on the back-end after that – are these just used at the claims stage or is there something else happening here (deep learning pre-inspection maybe )?

The only point that left me wondering a little bit is a particular claim made on the Naked website when it is explained that A “… flat fee means that our income doesn’t depend on how much we pay out in claims, so we have no reason to make claiming difficult.” I don’t think this is entirely true, despite the claim to the contrary – at the end of the day, if there are claims greater than 80% of written premium, someone will need to foot the bill, whether the insurer or the reinsurers. Therefore, claims will still need to be managed carefully to avoid upsetting these parties (insurer and reinsurers), and claims overruns of the 80% in the pot for an extended period of time will mean prices will need to go up. So I don’t think this has solved the “the age-old cycle of distrust between insurers and their customers” as neatly as one might think from the website.

As a conclusion, it is exciting to see a well-built startup bring an innovative insurance business model to South African shores!

Motor policy price comparisons – comparing apples with oranges


I recently tried to obtain a quote for comprehensive motor insurance from a price comparison website. The quote was on an older car, worth approximately R70k. After asking for some of my details, the comparison website presented me with something quite similar the following table of premiums and excesses.

Note that these are not the actual premiums and excesses quoted (due to copyright issues) but are modified by adding a normal random variable and then rounding the excesses. I don’t think these changes distort the economic reality of what I was quoted, but, nonetheless, these are not the actual numbers.

Premium Excess
1 458 9845
2 514 4840
3 534 7620
4 532 4580
5 544 4580
6 584 4580
7 571 4580
8 767 3920
9 894 4515

Most of the policies presented had similar terms and conditions – some sort of cashback benefit, hail cover and car rental. The distinguishing features seemed to be premium and excess. However, as a consumer, in this case, I found it difficult to compare these premiums, except for those with a R4.58k excess. What is a good deal and which of these is more overpriced? It makes some sense that policy number 9 is overpriced – I can get a lower excess for a lower premium, so this policy is definitely sub-optimal. But what about policy 8 – this has a low excess, but seems very expensive compared to the policies with only a slightly higher excess. Is this reasonable? Intuitively, and having some idea how motor policies are priced, my answer is no, but can we show this from the numbers presented?

Moral Soap Box (feel free to skip)

Before getting into the details of how I tried to work with these numbers, I think it is important to stop and consider the public interest. Would the general consumer of insurance have any idea how to compare these different premiums given the different excesses?  Probably not, in my opinion, leading to the title of this post. I guess that some rational consumers would be ‘herded’ into comparing policies 4-7, since they have the same excess, and maybe go for the cheapest one of those. But this is perhaps only a “local minimum” – maybe, in fact, one of the other policies offers better value. Also, one has to rely on the good faith of those running the comparison website to present policies with only the same terms and conditions, or else this supposedly rational strategy might backfire if policy number 4 has worse terms. Lastly, this all makes sense on day one – what will the insurer offering such a generous premium do over the lifetime of the policy – will they keep being so generous or will the consumer be horrified after a couple of steep price hikes.

Hence, this set of quotes seems to me a “comparison of apples with oranges”.

The code

As usual, the code for this post is on my Github, over here:

Note that code is under the open-source MIT License, so please read that if you want to use it!

The theory

Of course, if we had access to the pricing models underlying these premiums then it would be a simple matter to work out what is expensive and what is not, but the companies quoting were not so kind as to share these and only provided these point estimates. I have some ideas about the frequency of occurrence of motor claims and the average cost per claim, so ideally I would want to incorporate this information into whatever calculations I perform, pointing to the need for some sort of Bayesian approach to the problem. However, the issue here is that the price of a general non-Life/P&C policy is really the outcome of a complicated mathematical function – the collective risk process  – often represented by a compound Poisson distribution, which, to my knowledge, does not have an explicit likelihood function (which is why, in practice, actuaries will use Monte Carlo simulation or other approaches like the Panjer approximation or the Fast Fourier Transform to simulate from the distribution). Since most Bayesian techniques require an explicit likelihood function (or the ability to decompose the likelihood function into a bunch of simpler distributions), it would therefore be difficult to build a Bayesian model with standard methods like Markov Chain Monte Carlo (MCMC).

So, in this blog post I share an approach to this problem that I took using an amazing technique called Approximate Bayesian Computation (‘ABC’). To explain the basic idea, it is worth going back to the basics of Bayesian calculations, which try to make direct inferences about parameters in a statistical problem. These calculations generally progress in three steps

  • Prior information on the problem at hand is encoded in a statistical distribution for the parameters we are interested in. For example, the average cost per claim might be distributed as a Gamma distribution.
  • The data likelihood is then calculated based on a realization of the parameters from the prior distribution.
  • The likelihood of a set of parameters is then assessed as the product of a) the likelihood of getting that parameter set multiplied with b) the data likelihood divided by c) the total probability of all parameter sets and data likelihoods.

In this case, the data likelihood is not available easily. The basic idea of ABC is that in models with an intractable likelihood function, one can use a different method of ascertaining whether or not a parameter set is “likely” or not. That is, by generating data based on the prior distribution and comparing how “close” this generated data is to the actual data, one can get a feel for which parts of the prior distribution make sense in the context of the data, and which do not.

For some more information on ABC, have a look at this blog post and the sources it quotes:

The generative model and priors

I assumed that the number of claims, N, claims are distributed as a Poisson distribution, with a frequency parameter drawn from a beta distribution:

I selected the parameters of the Beta distribution to produce a mean frequency of .25 (i.e. a claim every four years) with a standard deviation of .075.

Cost per claim was modelled as a log-normal distribution:

Instead of putting priors on   and , which do not have an easy real world interpretation, instead I chose priors for the average cost per claim (ACPC) and the standard deviation of the cost per claim (SDCPC) , and, for each draw from these prior distributions, found the matching parameters for the log-normal. Both of these priors were modelled as Gamma distributions:

with the parameters of the gamma chosen so that the average cost per claim is R20k with a standard deviation of R2.5k and the standard deviation of the cost per claim is R10k with a standard deviation of R2.5k.

The code to find the corresponding log-normal parameters, once we have an ACPC and SDCPC is:

lnorm_par = function(mean, sd) {

cv = sd/mean

sigma2 = log(cv^2+1)

mu = log(mean)-sigma2/2

results = list(mu,sigma2)



Lastly, I assumed that the insurers are working to a target loss ratio of 70% (i.e. for every 70c of claims paid, the insurers will bring in R1 of income), with a standard deviation of 2.5%. This distribution also followed a beta, similar to the frequency rate.

The following algorithm was then run 100 000 times:

  • Draw a frequency parameter from the Beta prior
  • Simulate the number of claims from the Poisson distribution, using the frequency parameter
  • Draw an average cost per claim and it’s standard deviation, and find the corresponding log-normal distribution
  • For each claim, simulate a claim severity from the log-normal
  • For each excess with a corresponding premium quote, subtract the excess from the claims and add these up
  • The implied premium is the sum of the claims net of the excess divided by:
    • 12, since we are interested in comparing monthly premiums
    • the target loss ratio of the insurers, to gross up the premium for expenses and profit margins


So far we have generated lots of data from our priors. Now it is time to see which of the parameter combinations actually produce premiums reasonably in line with the quotes on the website. To simplify things, I put each of the simulated parameters into one of nine “buckets” depending on the percentile of the parameter within its prior distribution.

claims[,freq_bin :=ntile(freq,9)]

claims[,sev_bin :=ntile(acpc,9)]

claims[,sev_sd_bin :=ntile(acpc_sd,9)]

claims[,lr_bin :=ntile(LR,9)]

claims[,id:=paste0(freq_bin, sev_bin, sev_sd_bin, lr_bin)]

Then, indicative premiums for each bucket were derived by averaging the premiums derived in the previous section for each parameter “bucket”. The distance between the generated data and the actual quoted premiums was taken as the absolute percentage error:

And for the very last step, the median distance between the generated and quoted premiums was found for each parameter bucket. I only selected those “buckets” which produced a median distance of less than 8%. The median was used, instead of the mean, since I believe that some of the quotes are actually unreasonable, and I do not want to move the posterior distance too much in their favour by using a distance metric that is sensitive to outliers.

Now we have everything we need to show the posterior distributions of the parameters:

Some observations are that the prices I was quoted implies both a frequency and severity of claims that are a little bit higher than I assumed, but with a lower average cost per claim. The standard deviation of the average cost per claim is lower as well, with less weight given to the tails than I had assumed. Lastly, the loss ratio distribution matches the prior quite well.


Lastly, the implied prices are shown in red the next image.

Bearing in mind that this is all based on the assumption of actuarially unfair premiums – in other words, allowing the insurer to add a substantial profit to the actual risk premium by targeting a loss ratio of 70% – only three of the quotes are reasonable (two of those with an excess of R4.58k and the one with an excess of R4.84k). The rest of the quotes are significantly higher than can be justified by my priors on the key elements of the claims process, and it would seem irrational for a consumer with similar priors to take out one of these policies.


This post showed how it is possible to back out the parameters that underlie an insurance quote using prior information and Approximate Bayesian Computation.  Based on the analysis, we can go back to the original question I asked at the beginning of the post – is the low excess policy number 8 priced reasonably? The answer, based on my priors, seems to be “no”, and the excesses quoted here do not seem to be all that useful when it comes to explaining the prices of each quote.

What could be modelled more accurately? Some of the policies include a cashback, which we could priced explicitly using the posterior parameter distributions, but I personally attach very little utility to cashback benefits and would not pay more for one. So this is a more minor limitation, in my opinion.

I would love to hear your thoughts on this.