# “A 99% TVaR is generally a 99.6% VaR”

Almost 6 years ago, I posted a brief comment on a sentence I found surprising, by that time, discovered in a report claiming that

the expected shortfall […] at the 99 % level corresponds quite closely to the […] value-at-risk at a 99.6% level

which was inspired by a remark in Swiss Experience report,

expected shortfall […] on a 99% confidence level […} corresponds to approximately 99.6% to 99.8% Value at Risk

# Pricing Game

In November, with Romuald Elie and Jérémie Jakubowicz, we will organize a session during the 100% Actuaires day, in Paris, based on a “pricing game“. We provide two datasets, (motor insurance, third party claims), with 2  years of experience, and 100,000 policies. Each ‘team’ has to submit premium proposal for 36,000 potential insured for the third year (third party, material + bodily injury).

We will work as a ‘price aggergator’ with all the teams, with simple matching rules (the cheapest is chosen, or more complex rules, based on random selection among cheap insurers). The complete description is available on line.

R codes to read the datasets are

> training <- read.csv2(
+ "http://freakonometrics.free.fr/training.csv")
> dim(training)
[1] 100021     20
+ "http://freakonometrics.free.fr/pricing.csv")
> dim(pricing)
[1] 36311    15

Everyone is invited to play! The more, the merrier….

# On my way to Bruxelles, Belgium

After Amsterdam, the next stop is Bruxelles, Belgium. Here again, it is always a pleasure to get there… And then, time to get back home, to finalize some posts, prepare the new lectures, and answer all the late emails I got during those past days…

(illustration par l’immense Yves Chaland, français certes, mais qui a su relancer la ligne claire quand j’était jeune, dans l’esprit des grands belges, comme Franquin…  et le Jeune Albert se passe à Bruxelles, alors on va dire que je peux légitimement utiliser un de ses dessins pour illustrer un voyage à Bruxelles).

# On my way to Amsterdam, Netherlands

It is always a please to go to Amsterdam. But I believe it is my first time for summer time.

# On my way to København, Danemark

I will spend the week in København, it should be a lovely week, riding a bike !

# On my way to Malmö, Skåne

On my way to spend a few days in Sweeden, escaping the summer heatwave experienced this week in Berlin

# On my way to Berlin, Germany

Time for some sort of summer break….

# Computing AIC on a Validation Sample

This afternoon, we’ve seen in the training on data science that it was possible to use AIC criteria for model selection.

> library(splines)
> AIC(glm(dist ~ speed, data=train_cars,
[1] 438.6314
> AIC(glm(dist ~ speed, data=train_cars,
[1] 436.3997
> AIC(glm(dist ~ bs(speed), data=train_cars,
[1] 425.6434
> AIC(glm(dist ~ bs(speed), data=train_cars,
[1] 428.7195

And I’ve been asked why we don’t use a training sample to fit a model, and then use a validation sample to compare predictive properties of those models, penalizing by the complexity of the model.    But it turns out that it is difficult to compute the AIC of those models on a different dataset. I mean, it is possible to write down the likelihood (since we have a Poisson model) but I want a code that could work for any model, any distribution….

Hopefully, Heather suggested a very clever idea, using her package

And actually, it works well.

# “Improving Segmentation” (using Lorenz curves, or sort of)

This afternoon, André did send me an interesting graph about the use of Lorenz curve in the context of insurance pricing (and modeling)

It is some sort of Lorenz curve, upside-down, with on the x-axis the proportion of the population, and on the y-axis the proportion of the losses. The important point is that the population is sorted according the their risk, i.e. their premium. The code to generate such a curve is actually quite simple,

L <- function(u,varx="premium",vary="losses"){
base=base[order(base[,varx],decreasing=TRUE),]
base$cum=(1:nrow(base))/nrow(base) return(sum(base[base$cum<=u,vary])/
sum(base[,vary]))}

vu=seq(0,1,by=.01)
vv=Vectorize(function(u) L(u))(vu)

My concern was more on two labels on the figure, with on the top-left “perfect pricing” and on the first diagonal “average pricing“. What could that possibly mean? Is there even such a thing as a “perfect pricing“? In order to understand what we plot here, let us generate some dataset, and fit some model. Including things that might be seen as the “perfect model“: the price base on the parameters used to generate the data, and the model used to generate the data, fitted on the data.

# Modelling Occurence of Events, with some Exposure

This afternoon, an interesting point was raised, and I wanted to get back on it (since I did publish a post on that same topic a long time ago). How can we adapt a logistic regression when all the observations do not have the same exposure. Here the model is the following: ,

• the occurence of an event $Y_i^\star$ on the period $[0,1]$ is unobserved
• the occurence of an event $Y_i$ on $[0,E_i]$ is observed (as well as $E_i$)

If we assume that the ‘occurence of an event’ is the first occurence of a Poisson processus, we can prove that

$\mathbb{P}(Y^\star=0)=\mathbb{P}(Y^\star_{[0,1]}=0)=\mathbb{P}(Y^\star_{[0,E]}=0)\cdot \mathbb{P}(Y^\star_{[E,1]}=0)$

i.e. no event occur on $[0,1]$ if no event occur on $[0,E]$ and no event occur on $[E,1]$. Assuming independence between the two, we can prove that we have

$\mathbb{P}(Y^\star=0) = \mathbb{P}(Y=0)^E$

With words, it means that the probability of not having a claim in the first six months of the year is the square root of not have a claim over a year. Which makes sense.

# Visualising Claims Frequency

A few years ago, I did publish a post to visualize and empirical claims frequency in a portfolio. I wanted to update the code.

# Back at ENSAE, course on Non-Life Insurance Econometrics this Autumn

You might have seen recent pictures of the ENSAE Paristech building. Unfortunately, it will only open next year, in 2016, at Saclay.

This year, 2015-2016; is the last year of ENSAE in Malakoff,

I will be back the automn with a cours on “non-life insurance econometrics“. It could be seen as an updated version of the course we gave together with François Bucchini from 2003 till 2008.

The first course will start on October 12th. I will upload the syllabus and the first lectures notes by then. To be continued…

# On my way to Singapore

Today, I am flying to Singapore. I will spend a week there, doing some training on data science. I will probably post some codes following discussions we will have there. But before, I will enjoy Singapore. Last time I was there was 15 years ago, and I have the feeling that a lot of things have changed….

# Variation de Température

Hier, je suis tombé (via limportant.fr/) sur un documentaire intéressant, en ligne sur francetvinfo.fr/monde/environnement/. Mais le passage du début (retranscrit sur le site) m’a laissé une impression très étrange,

Au Groenland, la glace fond à vue d’œil. Cette année, le thermomètre est passé à 25 degrés au-dessus de 0. Il y a huit ans, pour la même période, le blizzard soufflait et les scientifiques devaient affronter des températures de – 35 degrés. Une amplitude de 65 degrés inquiétante pour les chercheurs qui observent la banquise depuis plus de 25 ans.

Ça veut dire quoi “inquiétant” ? Est-ce un phénomène nouveau ? Il y presque 5 ans, quand je suis arrivé à Montréal, j’avais mis en ligne un rapide billet comparant les températures à Rennes et à Montréal. En particulier, il y avait ces deux figures, avec les températures annuelles à Rennes,

avec en rouge un quantile supérieur observé, et un bleu un quantile inférieur (je ne prends pas les maximum et minimum pour lisser un peu). Disons que des écarts de 20 degrés, quelle que soit la période de l’année, ne sont pas impossible, loin de là. On peut parfaitement avoir 30 degrés un été, et 10 l’été suivant (ou disons, pour être plus précis, un 14 juillet il peut faire 30 degré, et le 14 juillet suivant 10). A Montréal, on avait

L’écart est ici un peu plus important. Contrairement à Rennes, il est plus important l’hiver que l’été. Et encore, à cette époque, le printemps érable n’avait pas eu lieu, avec presque 25 degrés en mars, alors qu’il est possible d’atteindre encore les -20 (ce qui fait un écart de 45 degrés). Je peux d’ailleurs remettre en ligne un billet que j’avais écrit, en demandant si la courbe des températures n’était pas une marche aléatoire. Des écarts de température de plus de 40 degrés ne sont pas rares. Entre un maximum pour une journée, et le minimum une autre années. Le plus troublant (ce n’est que mon expérience) c’était plutôt de gagner 40 degrés en une semaine, passer de -30 à +10 (puis replonger deux jours plus tard à -20)

Qu’en est-il du Groenland ? Sur eca.knmi.nl/dailydata, on peut récupérer les données journalières de température, de vent, etc, pour plus de 60 stations météo au Groenland. En faisant un petit code, on peut visualiser toutes les séries (en rouge et en bleu, on a les années les plus chaude et plus froide, en moyenne, moyennant que l’on ne tienne pas compte des valeurs manquantes). Le code est assez simple

setwd('/home/Documents/temperature-greenland/')
fichiers=list.files()
for(i in 1:length(fichiers)){
sc=scan(fichiers[i],what="char")[50:150]
i1=which(sc=="[DENMARK],")-1
i2=which(sc=="(STAID:")-1
station=paste(sc[i1:i2],collapse=" ")
date=as.Date(as.character(temp$DATE),format= "%Y%m%d") m=format(date, "%m") d=format(date, "%d") y=format(date, "%Y") date2=as.Date(paste("2000",m,d),format="%Y%m%d") temperature=temp$TG/10