Download presentation

Presentation is loading. Please wait.

Published byCasandra Joyner Modified about 1 year ago

1
Actuarial Modeling in R CAS Predictive Modeling Seminar Las Vegas October, 2007 Glenn Meyers, FCAS, MAAA Jim Guszcza, FCAS, MAAA

2
1 Contents R Background, Installing R on Your PC R Warm-up Examples 1-6

3
R Background

4
3 R is an open-source statistical programming language Pre-History: –R is based on the S statistical programming language developed at Bell labs in the 1980’s –The commercial package S-plus is based on the S language –R is an open-source implementation of the S language –Developed by Ross Ihaka & Robert Gentlemen at U. Aukland –Maintained/Developed by R development Core Team Features: –R is a high-level, object-oriented programming environment –R has advanced graphical capabilities –Statisticians around the world contribute add-on packages –Highly interactive in nature –Allows for experimentation and creativity –Known as “the statistician’s calculator”

5
4 Installing R Go to http://cran.r-project.org/http://cran.r-project.org/ Or just type “R” into Google and click “I feel lucky” Click on “Download CRAN” on the left of the screen Click on one of the USA CRAN mirror sites Click on “Windows (95 and later)” Click on “base” Right-click on R-2.5.1-win32.exe “Save target as” into any directory After you’ve downloaded this setup program, double-click on it and follow the instructions

6
5 Add-on Packages Click on “Packages” –Select “Install Package(s) Select a CRAN mirror

7
6 Add-on Packages “Packages” window will appear Select “MASS” and click OK MASS stands for Modern Applied Statistics in S By Venables and Ripley … add anything else you like. It’s all free There are hundreds of add-on packages available

8
R Warm-Up R as a Calculator Assignments Vectors, Matrices, Data Frames Getting Help Linear Models Maximum Likelihood Estimation

9
Example 1 Estimating a non-trivial loss distribution

10
9 Example 1: Fitting a Non-trivial Loss Distribution Here is a size-of-loss histogram for 539 claims Let’s estimate the true distribution that generated these claims.

11
Example 2 Curve Fitting

12
11 Example 2: Curve Fitting In this dataset, Y has a non- linear relationship with X Let’s fit a curve to this data

13
12 A 3-2-1 Neural Net

14
Example 3 Non-Linear Predictive Modeling

15
14 Example 3: Predictive Modeling Problem We have data on 369 Workers Comp claims –Age of claimant –Distance to work –Claim Duration Let’s build a model to predict Duration using Age and Distance

16
15 Tinn-R ( T his i s n ot n otepad) – A text editor for R Search Tinn-R on Google Free download Helpful in a lot of little ways

17
Example 4 Generalized Additive Model (GAM) Example

18
17 Generalized Additive Model (GAM) Similar to Generalized Linear Model (GLM) –Allows for non-linear predictors Select mgcv package

19
Example 5 Collective Risk Model Example

20
19 Collective Risk Model Easily viewed as a simulation –Select from a gamma distribution with mean 1 and variance c –Select N from a Poisson distribution with mean · Note – This process gives a negative binomial distribution –Select N claims from a Pareto distribution –X = Sum of the N claims Fast calculation with FFT’s –Discretize claim severity distribution Reference Loss Models by Klugman, Panjer and Willmot –p 185 and p 656 (2 nd Edition)

21
Example 6 Parameter Risk in Loss Reserving

22
21 Parameter Risk in Loss Reserve Estimates Expected Loss Payment in Lag t = Premium·ELR·((t|a,b)-(t-1|a,b) Observed loss in Lag t has an overdispersed Poisson distribution with Mean = Expected Loss Payment in Lag t Estimate ELR, a and b by maximum likelihood –Repeat on OD Poisson simulated data from fixed ELR, a and b References –Clark, CAS Forum (Fall 2003) –England and Verrall, PCAS 2001

23
22 A Package in R for Actuarial Science – ASTIN Colloquium actuar: an R package for Actuarial Science by Vincent Goulet The actuar project is a package of Actuarial Science functions for the R statistical system. The project was launched in 2005 and the package is available on CRAN (Comprehensive R Archive Network) since February 2006. The current version of the package contains functions for use in the fields of risk theory, loss distributions and credibility theory. This talk will present the most recent developments and demonstrate how the package can be useful in teaching, research and practice. http://www.actuaries.org/ASTIN/Colloquia/Orlando/Papers/Goulet.pdf Also http://www.actuarialoutpost.com has an excellent discussion of R under the “Software and Technology” forum. My nomination for the best reference from that site http://toolkit.pbwiki.com/RToolkit http://www.actuarialoutpost.com http://toolkit.pbwiki.com/RToolkit

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google