Last week the French National Institute of Health and Medical Research (Inserm) organised with the Stan Groupa training programme on Bayesian Inference with Stan for Pharmacometricsin Paris. Daniel Leeand Michael Betancourt, who run the course over three days, are not only members of Stan's development team, but also excellent teachers. Both were supported by Eric Novik, who gave an Introduction to Stanat the Paris Dataiku User Grouplast week as well.Eric Kramer (Dataiku), Daniel Lee, Eric Novik & Michael Betancourt (Stan Group)I have been playing around with Stan on and off for some time, but as Eric pointed out to me, Stan is not that kind of girl(boy?

I continue with the growth curve model for loss reserving from last week's post. Today, following the ideas of James Guszcza [2]I will add an hierarchical component to the model, by treating the ultimate loss cost of an accident year as a random effect. Initially, I will use the nlmeR package, just as James did in his paper, and then move on to Stan/RStan[6], which will allow me to estimate the full distribution of future claims payments.

Last week I posted a biological example of fitting a non-linear growth curvewith Stan/RStan. Today, I want to apply a similar approach to insurance data using ideas by David Clark [1]and James Guszcza [2].Instead of predicting the growth of dugongs (sea cows), I would like to predict the growth of cumulative insurance loss payments over time, originated from different origin years. Loss payments of younger accident years are just like a new generation of dugongs, they will be small in size initially, grow as they get older, until the losses are fully settled.

I suppose the go to tool for fitting non-linear models in R is nlsof the statspackage. In this post I will show an alternative approach with Stan/RStan, as illustrated in the example, Dugongs: “nonlinear growth curve", that is part of Stan's documentation. The original example itself is taken from OpenBUGS. The data describes the length and age measurements for 27 captured dugongs (sea cows). Carlin and Gelfand (1991)model the data using a nonlinear growth curve with no inflection point and an asymptote as $x_i$ tends to infinity:$$Y_i \sim \mathcal{N}(\mu_i, \sigma^2),; i = 1,\dots,27\\\\mu_i = \alpha - \beta \lambda^{x_i},; \alpha,, \beta > 0;, 0 < \lambda < 1 $$ Fitting the curve with nlsgives the following results:Writing the model in Stan requires a few more lines, but gives me also the opportunity to generate output from the posterior distributions.

It seems the summer is coming to end in London, so I shall take a final look at my ice cream data that I have been playing around with to predict sales statistics based on temperature for the last couple of weeks [1], [2], [3].Here I will use the new brms(GitHub, CRAN) package by Paul-Christian Bürknerto derive the 95% prediction credible interval for the four models I introduced in my first post about generalised linear models.

I continue my Stan experimentswith another insurance example. Here I am particular interested in the posterior predictive distribution from only three data points. Or, to put it differently I have a customer of three years and I'd like to predict the expected claims cost for the next year to set or adjust the premium.The example is taken from section 16.17 in Loss Models: From Data to Decisions[1]. Some time ago I used the same example to get my head around a Bayesian credibility model.

In my previous postI discussed how Longley-Cook, an actuary at an insurance company in the 1950's, used Bayesian reasoning to estimate the probability for a mid-air collision of two planes.Here I will use the same model to get started with Stan/RStan, a probabilistic programming language for Bayesian inference. Last week my prior was given as a Beta distribution with parameters $\alpha=1, \beta=1$ and the likelihood was assumed to be a Bernoulli distribution with parameter $\theta$: $$\begin{aligned}\theta & \sim \mbox{Beta}(1, 1)\\\y_i & \sim \mbox{Bernoulli}(\theta), ;\forall i \in N\end{aligned}$$For the previous five years no mid-air collision were observed, $x={0, 0, 0, 0, 0}$.

Suppose you have to predict the probabilities of events which haven't happened yet. How do you do this?Here is an example from the 1950s when Longley-Cook, an actuary at an insurance company, was asked to price the risk for a mid-air collision of two planes, an event which as far as he knew hadn't happened before. The civilian airline industry was still very young, but rapidly growing and all Longely-Cook knew was that there were no collisions in the previous 5 years [1].

It is really getting colder in London - it is now about 5°C outside. The heating is on and I have got better at measuring the temperature at home as well. Or, so I believe.Last week's approachof me guessing/feeling the temperature combined with an old thermometer was perhaps too simplistic and too unreliable. This week's attempt to measure the temperature with my Arduino might be a little OTT (over the top), but at least I am using the micro-controller again.

It is getting colder in London, yet it is still quite mild considering that it is late November. Well, indoors it still feels like 20°C (68°F) to me, but I have been told last week that I should switch on the heating. Luckily I found an old thermometer to check. The thermometer showed 18°C. Is it really below 20°C? The thermometer is quite old and I'm not sure that is works properly anymore.

At the R in Insurance conferenceArthur Charpentiergave a great keynote talk on Bayesian modelling in R. Bayes’ theorem on conditional probabilities is strikingly simple, yet incredibly thought provoking. Here is an example from Daniel Kahnemanto test your intuition. But first I have to start with Bayes’ theorem.Bayes’ theoremBayes’ theorem states that given two events $D$ and $H$, the probability of $D$ and $H$ happening at the same time is the same as the probability of $D$ occurring, given $H$, weighted by the probability that $H$ occurs; or the other way round.

Following on from last week, where I presented a simple example of a Bayesian network with discrete probabilitiesto predict the number of claims for a motor insurance customer, I will look at continuous probability distributions today. Here I follow example 16.17 in Loss Models: From Data to Decisions [1]. Suppose there is a class of risks that incurs random losses following an exponential distribution (density $f(x) = \Theta {e}^{- \Theta x}$) with mean $1/\Theta$.

Here is a little Bayesian Network to predict the claims for two different types of drivers over the next year, see also example 16.15 in [1]. Let's assume there are goodand baddrivers. The probabilities that a good driver will have 0, 1 or 2 claims in any given year are set to 70%, 20% and 10%, while for bad drivers the probabilities are 50%, 30% and 20% respectively. Further I assume that 75% of all drivers are good drivers and only 25% would be classified as bad drivers.

© Markus Gesmann CC BY-NC-SA 3.0 · Powered by the Academic theme for Hugo.