Case Study of How Actuaries Use R Mark Chisholm mark.chisholm@xlcatlin.com R in Insurance 2015 © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 1 Agenda • Background • Multivariate modelling • Interactive data visualisation • Enriching data sets • Lessons learned © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 2 Background The specialty insurance & reinsurance market offer protection for unique risks © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 3 Multivariate Modelling © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 4 Multivariate Modelling • Many actuaries use MS Excel to evaluate multiple predictors using one-way tables Years on Claims Made Row Labels 1 year 2 years 3 years 4 years 5 years 6 or more years (blank) Grand Total Sum of Premium Sum of Incurred 950,000 1,083,000 250,000 187,500 1,800,000 1,651,500 1,450,000 1,290,500 2,300,000 2,128,500 4,600,000 4,449,500 11,350,000 10,790,500 Attachment Point USD Row Labels Sum of Premium Sum of Incurred Less than 100k 1,150,000 932,500 At least 500k but less than 1m 8,200,000 7,971,500 Greater than 10m 2,000,000 1,886,500 (blank) Grand Total 11,350,000 10,790,500 © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO LR 114.0% 75.0% 91.8% 89.0% 92.5% 96.7% 95.1% LR 81.1% 97.2% 94.3% 95.1% 5 Multivariate Modelling • Obtaining an initial fit using multivariate modelling techniques only requires a few lines of code • Generalised linear models • Techniques less widely used in insurance • Discriminant analysis (MASS package) • Random forests (randomForest package) • Actuarial exams emphasise that one-way techniques can mask exposure correlations © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 6 Multivariate Modelling • It is worth exploring different ideas • Test different response variables and models • Claim frequencies or severities • Probability that there will be a claim notified • Probability that the incurred loss ratio will exceed a benchmark • Test different predictors • Territory, premium band, revenues, deductible/excess, limit, etc. • Experiment with including or not including different actuarial assumptions such as trend, loss development, on-leveling, etc. • Use external data to supplement your predictors (more on this later) © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 7 Multivariate Modelling • If you have already prepared your data in Excel, why not load it into R and perform a multivariate analysis? • You could: • Save the table you wish to analyse as a tab-delimited text file • Make use of packages such as as RExcel or XLConnect © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 8 Multivariate Modelling • An illustrative example of using logistic regression © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 9 Multivariate Modelling • An illustrative example of using logistic regression © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 10 Interactive Data Visualisation © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 11 Interactive Data Visualisation • Information is often shared through standardised reports • Hardcopy printout, pdf, MS Word doc, etc. Line of Business 1 Territory Country A Country B Country C Premium Number of Policies Incurred Loss Claim Count 5,000,000 10 680,000 10,000,000 18 9,820,000 13,000,000 31 9,945,000 1 2 16 Incurred Loss Ratio 13.6% 98.2% 76.5% Premium Number of Policies Incurred Loss Claim Count 9,000,000 82 10,300,000 13,000,000 101 12,450,000 4,000,000 52 4,105,000 58 82 44 Incurred Loss Ratio 114.4% 95.8% 102.6% 1 0 0 Incurred Loss Ratio 0.0% 0.0% 0.0% Line of Business 2 Territory Country A Country B Country C Line of Business 3 Territory Country A Country B Country C Premium Number of Policies 12,500,000 0 0 Incurred Loss 3 0 0 Claim Count 0 0 0 © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 12 Interactive Data Visualisation • The shiny package lets you make interactive web sites very quickly • Knowledge of JavaScript, HTML, and other web programming languages is not required • Supports the use of ggplot2, googleVis, etc. for graphics © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 13 Interactive Data Visualisation • Monthly loss development using shiny and googleVis © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 14 Interactive Data Visualisation • Drop-down lists • Buttons • Check boxes • Radio buttons • Free form entry • Sliders © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 15 Enriching Data Sets © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 16 Enriching Data Sets • Internal sources of data are often the first place to look when trying to understand the characteristics of policyholders • Deductible/attachment point • Territory • Premium charged • Perhaps various coding specific to the class of business © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 17 Enriching Data Sets • External data sources should also be considered • Underwriters may be able to point you to web sites with relevant data • Demographic, geologic, economic, atmospheric, etc. • Consider the raster package for working with geospatial data kept in raster format (.bil files) © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 18 Enriching Data Sets • Working with raster images © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 19 Lessons Learned © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 20 Lessons Learned • Common concerns • “I’m not a programmer, I don’t have the time to learn R” • Focus on one bite-sized task to do in R and do the rest using the tools you are comfortable with • Repeatable tasks • Monthly MI with nice charts • Fitting statistical models © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 21 Lessons Learned • Common concerns • “I don’t have enough data to do multivariate analysis” • If you have enough data to evaluate multiple variables on a oneway basis you have enough to try multivariate approaches © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 22 Lessons Learned • Common concerns • “I downloaded R but it has a complex user interface and is difficult to use” • Use a search engine to find an “IDE for R” – this kind of tool makes it much easier to write source code © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 23 Lessons Learned • A helpful resource for actuaries: • Puts statistical ideas into plain English, which is ideal for practitioners • Has labs with sample R code, which makes it easy to apply the techniques to your company’s data sets • Available for free from author’s web site © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 24 Questions? © 2015, XL Catlin companies. All rights reserved. I MAKE YOUR WORLD GO 25