# Category: Uncategorized

## 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: https://lnkd.in/edv5s9k

– 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: https://lnkd.in/eRAddBd

– Lastly, this paper proposes an interesting combination of a decision tree model with Bühlmann-Straub credibility: https://lnkd.in/eJts5Mp

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:

PaperA 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.

*References*

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:

- accompanying paper:

- code to reproduce some of the results:

https://github.com/RonRichman/AI_in_Actuarial_Science/

## 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:

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3218082

and code here:

https://github.com/RonRichman/AI_in_Actuarial_Science

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 3^{rd} 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:

http://www.fharrell.com/post/stat-ml/

**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.

**References**

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. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3102371. Accessed: 29 June 2018.

Gao, G. and M. Wüthrich. 2017. *Feature Extraction from Telematics Car Driving Heatmaps*. SSRN. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3070069. 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. https://ssrn.com/abstract=3164764 Accessed: 17 June 2018.

Wüthrich, M. 2018a. *Neural networks applied to chain-ladder reserving*. SSRN. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2966126. Accessed: 1 July 2018.

Wüthrich, M. 2018b. *v-a Heatmap Simulation Machine*. https://people.math.ethz.ch/~wueth/simulation.html. Accessed: 1 July 2018.

Wüthrich, M. and C. Buser. 2018. *Data analytics for non-life insurance pricing*. Swiss Finance Institute Research Paper. https://ssrn.com/abstract=2870308. 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 13^{th} 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

__Introduction__

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:

https://github.com/RonRichman/ABC_pricing/

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:

http://www.sumsar.net/blog/2014/10/tiny-data-and-the-socks-of-karl-broman/

__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) results }

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

__Inference__

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.

__Prices__

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.

__Conclusion__

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.

## Bridging between the tribes – chain-ladder and lifetables

__Introduction__

During the last few years of my career I have had the opportunity to work in two of the major fields of practice for actuaries – life insurance and non-life insurance. Something that always bothered me is that actuaries who perform reserving work in either of these two areas use totally different techniques from each other.

Life actuaries will generally build cash-flow models to project out expected income and outgo to derive the expected profit for each policy they are called on to reserve for, which is then discounted back to produce the reserve amount. One of the key inputs into this type of reserving model is a life table which tabulates mortality rates which apply to the insured population that is being reserved for.

Non-life actuaries, on the other hand, almost never build cash-flow models, but will apply a range of techniques to past claims information (arranged into a “triangle”, see later in the post for a famous example) to derive expected claims amounts that are held as an incurred but not reported reserve (IBNR). Some of these techniques are the chain-ladder, the Bornhuetter-Ferguson (Bornhuetter and Ferguson 1973) and Cape-Cod techniques (Bühlmann and Straub 1983). Lifetables are never considered.

It would make sense intuitively that there is some connection between these two “tribes” of actuaries who, after all, are both trying to do the same things, but for different types of company – make sure that the companies have enough funds held back to fund claims payments. This post tries to illustrate that in fact, hidden away in the chain-ladder method, there is an implicit life table calculation and that IBNR calculations can be cast in a life table setup. The key idea was actually expressed in a paper I wrote for the 2016 ASSA convention with Professor Rob Dorrington and appeared as an appendix in the paper.

Something else that the idea helps with is that it provides an explanation why the chain-ladder is so popular and seems to work well. The chain-ladder method remains the most popular choice of method for actuaries reserving for short term insurance liabilities globally and in South Africa (Dal Moro, Cuypers and Miehe 2016). Although stochastic models have been proposed for the chain-ladder method by Mack (1993) and Renshaw and Verrall (1998), the underlying chain-ladder algorithm is still described in the literature as an heuristic, see for example Frees, Derrig and Meyers (2014).

The simple explanation for the success of the chain-ladder method is that underlying the estimates of reserves produced by the chain-ladder method is a life table and that the chain-ladder method is actually a type of life-table estimator.

The rest of the post shows the simple maths and some R code to “pull out” a life table for the chain-ladder calculation. In a future post, I hope to discuss some other helpful intuitions that can be built once the basic idea is established.

The code for this post is available on my GitHub account here:

__Chain-ladder calculations __

Define:

as the claims amount relating to accident year i in development period J, where there are I accident years and J development years. An example claims triangle is shown below, that appears in Mack (1993). This triangle can easily be pulled up in R by running the following code that references the excellent Chainladder package:

require(ggplot2) require(ChainLadder) require(data.table) require(reshape2) require(magrittr) GenIns

i | C(i,1) | C(i,2) | C(i,3) | C(i,4) | C(i,5) | C(i,6) | C(i,7) | C(i,8) | C(i,9) | C(i,10) |
---|---|---|---|---|---|---|---|---|---|---|

1 | 357 848 | 1 124 788 | 1 735 330 | 2 218 270 | 2 745 596 | 3 319 994 | 3 466 336 | 3 606 286 | 3 833 515 | 3 901 463 |

2 | 352 118 | 1 236 139 | 2 170 033 | 3 353 322 | 3 799 067 | 4 120 063 | 4 647 867 | 4 914 039 | 5 339 085 | |

3 | 290 507 | 1 292 306 | 2 218 525 | 3 235 179 | 3 985 995 | 4 132 918 | 4 628 910 | 4 909 315 | ||

4 | 310 608 | 1 418 858 | 2 195 047 | 3 757 447 | 4 029 929 | 4 381 982 | 4 588 268 | |||

5 | 443 160 | 1 136 350 | 2 128 333 | 2 897 821 | 3 402 672 | 3 873 311 | ||||

6 | 396 132 | 1 333 217 | 2 180 715 | 2 985 752 | 3 691 712 | |||||

7 | 440 832 | 1 288 463 | 2 419 861 | 3 483 130 | ||||||

8 | 359 480 | 1 421 128 | 2 864 498 | |||||||

9 | 376 686 | 1 363 294 | ||||||||

10 | 344 014 |

The chain-ladder algorithm predicts the next claims amount in the table:

as:

where f is the so called loss development factor in development period j.

The volume weighted estimator of the loss development factor is defined in Mack (1993) as:

The estimate of the ultimate claims – the claims amount after all of the claims development is finished – for accident year i is given by:

In R, most of the chain-ladder calculations have been helpfully automated. To produce the loss development factors and an estimate of the IBNR, one runs the following code:

fit = ChainLadder::MackChainLadder(GenIns) plot(fit)

__Estimating the life table__

Now for the lifetable. The percentage of claims developed by development period j is defined as:

and the percentage of claims developed in period j is:

The claims development can be cast in demographic terms as follows. Assume that for each accident year i, a population of claims:

will eventually be reported. In each development period j:

of the claims will be reported, or will “die”. The term is therefore comparable to the demographic quantity:

which is the probability of death in the period j, after surviving to time j. A full lifetable can then be derived from:

This is shown in the next table and plot, followed by the R code to produce the numbers.

j | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|---|

C(i,j+1) | 11 614 543 | 17 912 342 | 21 930 921 | 21 654 971 | 19 828 268 | 17 331 381 | 13 429 640 | 9 172 600 | 3 901 463 | |

C(i,j) | 3 327 371 | 10 251 249 | 15 047 844 | 18 447 791 | 17 963 259 | 15 954 957 | 12 743 113 | 8 520 325 | 3 833 515 | |

f(j) | 3.49 | 1.75 | 1.46 | 1.17 | 1.10 | 1.09 | 1.05 | 1.08 | 1.02 | 1.00 |

F(j,J) | 14.45 | 4.14 | 2.37 | 1.63 | 1.38 | 1.25 | 1.15 | 1.10 | 1.02 | 1.00 |

tq0 | 0.07 | 0.24 | 0.42 | 0.62 | 0.72 | 0.80 | 0.87 | 0.91 | 0.98 | 1.00 |

t|q0 | 0.07 | 0.17 | 0.18 | 0.19 | 0.11 | 0.07 | 0.07 | 0.05 | 0.07 | 0.02 |

qx | 0.07 | 0.19 | 0.24 | 0.33 | 0.28 | 0.27 | 0.34 | 0.35 | 0.80 | 1.00 |

tpx | 0.93 | 0.76 | 0.58 | 0.38 | 0.28 | 0.20 | 0.13 | 0.09 | 0.02 | – |

px | 0.93 | 0.81 | 0.76 | 0.67 | 0.72 | 0.73 | 0.66 | 0.65 | 0.20 | – |

t_prime_qx = c(PERC_DEV[1], diff(PERC_DEV)) max_age = length(PERC_DEV) px = numeric(10) tpx = numeric(10) qx = numeric(10) px[1] = (1-t_prime_qx[1]) tpx[1] = px[1] qx[1]= t_prime_qx[1] for (i in 2:length(PERC_DEV)){ print(i) qx[i] = t_prime_qx[i]/tpx[i-1] px[i] = (1-qx[i]) tpx[i] = tpx[i-1]* px[i] } lifetable = data.table(t = seq(1,max_age), PERC_DEV=PERC_DEV,px = px, tpx=tpx, qx=qx,t_prime_qx=t_prime_qx ) lifetable_melt = lifetable %>% melt(id.var="t") %>% data.table() lifetable_melt %>% ggplot(aes(x=t, y=value)) + geom_line(aes(group = variable, colour = variable)) + facet_wrap(~variable)

__Conclusion__

When will the above calculations work well? These calculations make sense when dealing with triangles that increase monotonically i.e. do not allow for over-reserving or salvage and recoveries. A good example is on count triangles of paid claims.

Now that we have shown that the chain-ladder estimates a lifetable, the question is whether this is just an interesting idea that lets one connect two diverse areas of actuarial practice, or if any significant insights with practical implications can be derived. That will be the subject of the next post.

__References__

Bornhuetter, R. and R. Ferguson. 1973. “The Actuary and IBNR”, *Proceedings of the Casualty Actuary Society* **Volume LX, Numbers 113 & 114**

Bühlmann, H. and E. Straub. 1983. “Estimation of IBNR reserves by the methods chain-ladder, Cape Cod and complementary loss ratio,” Paper presented at International Summer School. Vol. 1983:

Dal Moro, E., F. Cuypers and P. Miehe. 2016. *Non-life Reserving Practices*. ASTIN.

Frees, E.W., R.A. Derrig and G. Meyers. 2014. “Predictive Modeling in Actuarial Science”, *Predictive Modeling Applications in Actuarial Science* **1**:1.

Mack, T. 1993. “Distribution-free calculation of the standard error of chain-ladder reserve estimates”, *Astin Bulletin* **23**(02):213-225.

Renshaw, A.E. and R.J. Verrall. 1998. “A stochastic model underlying the chain-ladder technique”, *British Actuarial Journal* **4**(4):903-923.

## AI in Actuarial Science

The CEO of Lemonade, Dan Schreiber, made the statement in a recent talk that:

*“The future of insurance will be staffed by bots rather than brokers and AI in favor of actuaries.”*

Despite sounding rather impressive, the Youtube video of the rest of Dan’s talk doesn’t really go into much detail to explain his thinking. That being said, this statement seems to be predicated on the view that actuarial science won’t evolve to embrace AI and bring the tools of modern statistical and machine learning into the everyday practice of actuaries. I personally think this view is inaccurate, and that actuaries practicing in “the future” will just as easily turn to a machine learning algorithm as they will to the traditional tools of the trade. Together with the domain specific knowledge of insurance that actuarial training brings, I think this will be a powerful combination that will serve the insurance industry well.

One reason I feel comfortable making this prediction is that the actuarial literature is starting to examine AI and machine learning, and how it can be applied to traditional actuarial problems. Many of the best examples that I have seen are from Professor Mario Wüthrich (who, together with his colleagues, is credited with the thinking and formula behind the Solvency II Reserving Risk formula). Some of his work includes applying deep neural networks to telematics data and machine learning approaches to the problem of IBNR reserving. Other recent papers include one applying deep auto-encoders to analyse population mortality in a Lee-Carter setup and another examining gradient boosted Tweedie models for pricing.

I plan to examine some of these new ideas in actuarial science on this blog in the next couple of posts and also provide code in R and Python on my Github account that will allow anyone who is interested to see how to apply these ideas practically. First up will be auto-encoders, which are a form of dimensionality reduction used to summarize high dimensional data in a low dimensional form. As an example of high dimensional data, think of a life table that has entries for the mortality rate for each age in the table. A life table with rates up to age 110 can be thought of a 110 dimensional vector. Although it is not a new idea to summarize a life table with a only a few parameters (the mortality laws, the Lee-Carter model using SVD and Brass’ Logit Transform spring to mind), recent work has shown that neural networks can estimate these summaries more accurately than traditional methods.

I also plan to build a section on my website that acts as a guide to this emerging field of actuarial science that I hope will be useful to other actuaries (and professionals) who want to understand how AI and machine learning can be applied to actuarial problems. As a start, some of the excellent material from Prof Wüthrich is available on his website.

Insurance seems to have become an exciting industry to work in these days and I am equally excited about the opportunities that lie ahead for actuaries and other insurance professionals.