Preface

This book aims to provide a broad introduction to computational aspects of actuarial science in the R environment. We assume that the reader is either learning or is familiar with actuarial science. It can be seen as a companion to standard textbooks on actuarial science. This book is intended for various audiences: students, researchers, and actuaries.

As explained in Kendrick et al. (2006) (discussing the importance of computational economics):

Our thesis is that computational economics offers a way to improve this situation and to bring new life into the teaching of economics in col leges and universities [...] computational economics provides an opportunity for some students to move away from too much use of the lecture-exam paradigm and more use of a laboratory paper paradigm in teaching undergraduate economics. This opens the door for more creative activity on the part of the students by giving them models developed by previous generations and challenging them to modify those models.

Based on the assumption that the same holds for computational actuarial science, we decided to publish this book.

As claimed by computational scientists, computational actuarial science might simply refer to modern actuarial science methods. Computational methods probably started in the 1950s with Dwyer (1951) and von Neumann (1951). The first one emphasized the importance of linear computations, and the second one the importance of massive computations, using random number generations (and Monte Carlo methods), while (at that time) access to digital computers was not widespread. Then statistical computing and computational methods in actuarial science intensified in the 1960s and the 1970s, with the work of Wilkinson (1963) on rounding errors and numerical approximations, and Hemmerle (1967) on computational statistics. Then, the S language started, initiating R.

- R -

R includes a wide range of standard statistical functions and contributed packages that extend the range of routine functions, including graphical methods. And once we get used to it, R is an easy and intuitive programming language. As explained in Becker (1994): “from the beginning, S was designed to provide a complete environment for data analysis. We believed that the raw data would be read into S, operated on by various S functions, and results would be produced. Users would spend much more time computing on S objects than they did in getting them into or out of S.” In the statistical literature, new methods are often accompanied by implementation in R, so that R became a sort of lingua francain the statistical community (including connected areas, from social science to finance, and actuarial science).

The best way to learn computational actuarial science is to do computational actuarialscience. And one of the best ways to do computational actuarial science is probably to start with existing models, and to play with them and experiment with them. This is what we tried to do in this book. The focus in the book is on implementation rather than theory, and we hope to help the reader understand the concepts without being burdened by the theory. Nevertheless, references will be mentioned for those willing to go back to the theory.

A long time ago, before becoming the CEO of AXA, Claude Bébéar published an article on clarity and truth on the accounts of a life-insurance company, starting with a short Persian tale:

Once upon a time, there was a very clever, prominent and respected life insurer. He was regarded by al l as a great technician, perhaps even a savant. There was no one but him to estimate the premium to charge the insured, and to value commitments of the insurer. But sometimes he had nagging doubts: was his science really valued? What if mere commoners got their hands on this science, insinuating that there was nothing admirable about it and in so doing, destroying his reputation he had so patiently built? He had to act swiftly to protect himself. And so our esteemed insurer, respected and ever so clever, invented an esoteric language he called “actuarial science”. Thanks to him, generations of contented actuaries lived and still live in the shelter of potential critics, adored by al l. Each year, bolstered by the solid respect of accountants, they develop impressive Annual Reports which those who are insured, shareholders and controllers of al l kinds contemplate without understanding and without daring to ask questions for fear of sounding stupid. The system was perfect.

If actuarial science can be seen as an esoteric language to the vulgar, then computational aspects are usually seen as magic tricks. This is what Clarke (1973) mentioned in his so-called third law of prediction, when claiming that “any sufficiently advanced technology is indistinguishable from magic.” The ambitious goal of this book is to demystify computational aspects of actuarial science, and to prove that even complex computations can usually be done without too much pain. I hope that after reading this book, everyone will be able to become a magician.

- Introduction to the R language -

Chapter 1 will provide an introduction to the R language, for Windows, Mac OS X, and Linux users. We will see how to manipulate standard objects, how to write a function, how to import a dataset, how to deal with dates, how to plot graphs, etc. The difficult part of books on computational techniques is to find a balance between

  • a code efficient and fast, but where the algorithm is not explicit; and
  • a simple code, where iterations or sums can be visualized easily, but which might be slow.

The goal of the book is to provide an introduction to computational aspects of actuarial science, so we will focus on simple codes. Nevertheless, more advanced methods will be mentioned, such as parallel computing, and C/C++ embedded codes. Several technical aspects of R will be mentioned in this introduction, but can be skipped the first time the reader goes through the book. A dedicated section will introduce graphics with R. As Yogi Berra (baseball player and/or philosopher) said:

You can see a lot by just looking.

Visualization is extremely important, and simple R code can help to plot (almost) anything. After reading those pages, anyone will be able to understand the computational aspects of the algorithms dedicated to actuarial computations described in the following chapters.

- Statistical Models with R -

From Chapter 2, Chapter 3, Chapter 4, Chapter 5 and Chapter 6, we will get back to the methodology and statistical modeling issues, with R. Because these chapters focus on methodological aspects, several packages will be used in each chapter (while later on, for each specific application, one dedicated package will be used). In Chapter 2, Christophe Dutang will discuss standard inference, with a description of univariate loss distribution, parametric inference, and goodness of fit. A section will be dedicated to the collective model and aggregate loss distribution, and a section will also mention multivariate distribution and copulas. In Chapter 3, Arthur Charpentier and Benedict Escoto will introduce the Bayesian philosophy, insisting on Bayesian computation. Two sections will focus on important applications: regression modeling from a Bayesian perspective and credibility models. Then, in Chapter 4, Arthur Charpentier and Stéphane Tufféry will give an overview of credit scoring and statistical learning. The goal of this chapter is to describe techniques used to model a binary variable, starting with a logistic regression (from the standard version to ridge and lasso regression techniques), classification trees, random forests, and concluding with boosting of trees. Then, in Chapter 5, Renato Assunçãao, Marcelo Azevedo Costa, Marcos Oliveira Prates, and Lu´ıs Gustavo Silva e Silva will introduce spatial analysis, with an application to car accidents. And finally, in Chapter 6, Eric Gilleland and Mathieu Ribatet will recall extreme value theory, with an application on reinsurance pricing.

- Life Insurance and Mortality with R -

Chapter 7, Chapter 8, Chapter 9 and Chapter 10 discuss the computational aspects of life insurance. In Chapter 7, Giorgio Spedicato will discuss life contingencies calculations using R. Then, in Chapter 8, Heather Booth, Rob J. Hyndman, and Leonie Tickle will introduce prospective life tables, and extend computations of Chapter 7 by incorporating a dynamic component on population datasets. In Chapter 9, Julien Tomas and Frédéric Planchet will focus on prospective life tables from an insurer”s perspective, and willing to use portfolio experience. And finally, in Chapter 10, Frédéric Planchet and Pierre-E. Thérond will recall techniques used in survival analysis when dealing with censored data (with partial information).

- actuarial Finance with R -

In Chapter 11, Chapter 12 and Chapter 13, we will focus on finance from an actuarial perspective. In Chapter 11, Yohan Chalabi and Diethelm Würtz will discuss stock price models and nonlinear timeseries. In Chapter 12, Sergio S. Guirreri will describe standard techniques used to modelyield curves and interest rates models, again from an actuarial perspective. And finally, in Chapter 13, Yohan Chalabi and Diethelm Würtz will present techniques used on portfolio optimization problems.

- Nonlife Insurance with R -

Finally, in Chapter 14, Chapter 15 and Chapter 16, we will see how to use R to deal with computational aspects of nonlife insurance. In Chapter 14, Jean-Philippe Boucher and Arthur Charpentier will discuss motor insurance pricing, using generalized linear models, to model claims frequency, and average costs of motor claims. In Chapter 15, Katrien Antonio, Peng Shi, and Frank van Berkum will discuss extension on longitudinal models, introducing dynamics. In this chapter, they mention no-claim bonus systems, and make connections with credibility models described in Chapter 3. And finally, in Chapter 16, Markus Gesmann will show how to use R for IBNR computations and loss reserving.

- Before Starting -

To read the book, keep in mind that all chapters are independent (at least from a computational point of view). We suggest starting with an empty workspace to ensure that no lurking objects can affect code execution. Emptying the workspace is easy using

> rm(list = ls())

Then datasets used in this book data can be obtained in an R package called CASdatasets that accompanies this book. It is available from the CRAN servers at http://CRAN.R-project. org/.

On a computer connected to the Internet, its installation is as simple as typing

> install.packages("CASdatasets")at the prompt. Note that additional references can be downloaded from

https://github.com/CASwithR

- Acknowledgements -

As the editor of the book, I am honored and proud that all the contributors agreed to spend time on this book. All of them know more about the topic they write about than I do, and most of them have written a package (sometimes several) used in computational actuarial science. One of the constraints mentioned when I asked them to write their chapter is related to the reproducibility concept mentioned in the first paragraph of this preface: every reader should be able to reproduce what contributors have done. But probably more important, I do not expect the readers to believe-blindly-that what they read is valid. I specifically asked the contributors to show the core of the algorithm, so that readers can reproduce what they have done with their own packages, as I truly believe in the power of the do-it-yourself strategy, especially to understand algorithms.

All programs and data in this book are provided in good faith. The authors do not guarantee their accuracy and are not responsible for the consequences of their use.

Finally, I should also mention that we tried in this book to mention important references on actuarial models and computational aspects. Readers not (yet) familiar with R will find there are dozens of recent books published on the R language. But they should keep in mind that the strength of R is probably the community of R users. Most large cities in the world now have their own R groups, and the community is extremely active online. For instance, stackoverflow (a popular question-and-answer site “for professional and enthusiast programmers”) has a tag for R related questions, http://stackoverflow.com/questions/tagged/r. See also http://r.789695.n4.nabble.com/ for another large forum. I should also mention blogs, as some of the contributors have one (and additional information related to what they have can be found on their own blog). A nice blog aggregator is r-bloggers where almost 500 bloggers contribute, see http://www.r-bloggers.com/.

To conclude, I want to thank colleagues and friends for their valuable comments on preliminary drafts of this book (Michel Denuit, Ewen Gallic, José Garrido, Hél`ene Guérin, Stuart Klugman, Dan Murphy, Emiliano Valdez); students who asked for more computational aspects in actuarial courses; actuaries who asked for more details on how to implement theoretical methods they have seen in conferences; and all the staff from Chapman & Hall/CRC, starting with John Kimmel (without forgetting Marcus Fontaine), for their constant support of this project.

Arthur Charpentier, Montréal

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.21.152