Download presentation
Presentation is loading. Please wait.
Published byPeter Summers Modified over 9 years ago
1
Actuarial Modeling in R CAS Spring Meeting June, 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 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.3.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
Example 3 Non-Linear Predictive Modeling
14
13 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
15
14 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
16
Example 4 Generalized Additive Model (GAM) Example
17
16 Generalized Additive Model (GAM) Similar to Generalized Linear Model (GLM) –Allows for non-linear predictors Select mgcv package
18
Example 5 Collective Risk Model Example
19
18 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)
20
Example 6 Parameter Risk in Loss Reserving
21
20 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
22
21 A Package in R for Actuarial Science – ASTIN Colloquium actuar: an R package for Actuarial Science 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.