(This article was first published on

**Freakonometrics - Tag - R-english**, and kindly contributed to R-bloggers)I will be giving a short course in Switzerland next week, at the *6th R/Rmetrics Meielisalp Workshop & Summer School on Computational Finance and Financial Engineering *organized by ETH Zürich, https://www.rmetrics.org/. The long version of the slides for the course on **Actuarial models with R **can be found online with the #Rmetrics tag, and the short version will be uploaded soon. There will be some practicals, based on Swiss mortality table for the part on demography. The datasets can be uploaded using the following code,

DEATH=read.table( "http://freakonometrics.free.fr/DeathsSwitzerland.txt", header=TRUE,skip=2) EXPOSURE=read.table( "http://freakonometrics.free.fr/ExposuresSwitzerland.txt", header=TRUE,skip=2) DEATH$Age=as.numeric(as.character(DEATH$Age)) DEATH=DEATH[-which(is.na(DEATH$Age)),] EXPOSURE$Age=as.numeric(as.character(EXPOSURE$Age)) EXPOSURE=EXPOSURE[-which(is.na(EXPOSURE$Age)),]

- based on those datasets, plot the log mortality rates for male and female,

- for those two datasets, plot the log mortality rates in 1900 and 1950, respectively

- for those two datasets, plot the log mortality rates for the cohort born on 1900 and 1950, respectively

- on the
*total*dataset (male and female), fit a Lee-Carter model. Plot the*age coefficients*

- plot the
*time coefficients*and propose a forecast for that series of estimators.

- plot the residuals obtained from the regression

- using those estimates, and the forecasts, project the log-mortality rates

- extrapolate the survival function of an insured aged 40 in 2000, and compare it with the one obtained on the longitudinal dataset.

- based on those survival functions, compute actuarial present values for several quantities, e.g. whole life annuities for some insured aged 40, and whole life insurances, and compare those values from 1900 till 2040 (
*on the graphs below, titles were inverted*).

Then, we will briefly mention payment triangles. We will work on the triangle used on http://rworkingparty.wikidot.com/ that can be downloaded below,

OthLiabData=read.csv( "http://www.casact.org/research/reserve_data/othliab_pos.csv", header=TRUE, sep=",") library(plyr) OL=SumData=ddply(OthLiabData,.(AccidentYear,DevelopmentYear, DevelopmentLag),summarise,IncurLoss=sum(IncurLoss_H1-BulkLoss_H1), CumPaidLoss=sum(CumPaidLoss_H1), EarnedPremDIR= sum(EarnedPremDIR_H1)) LossTri <- as.triangle(OL, origin="AccidentYear", dev="DevelopmentLag", value="IncurLoss") Year=as.triangle(OL, origin="AccidentYear", dev="DevelopmentLag", value="DevelopmentYear") TRIANGLE=LossTri TRIANGLE[Year>1997]=NA

Here, the triangle looks like that

> TRIANGLE dev origin 1 2 3 4 5 6 7 8 9 10 1988 128747 195938 241180 283447 297402 308815 314126 317027 319135 319559 1989 135147 208767 270979 304488 330066 339871 344742 347800 353245 NA 1990 152400 238665 297495 348826 359413 364865 372436 372163 NA NA 1991 151812 266245 357430 400405 423172 442329 460713 NA NA NA 1992 163737 269170 347469 381251 424810 451221 NA NA NA NA 1993 187756 358573 431410 476674 504667 NA NA NA NA NA 1994 210590 351270 486947 581599 NA NA NA NA NA NA 1995 213141 351363 444272 NA NA NA NA NA NA NA 1996 237162 378987 NA NA NA NA NA NA NA NA 1997 220509 NA NA NA NA NA NA NA NA NA

- suggest an estimation for the amount of reserves, all years.
- using a Poisson regression, propose a VaR with level 99.5% for future payments, for all claims that already occurred.

To

**leave a comment**for the author, please follow the link and comment on his blog:**Freakonometrics - Tag - R-english**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...