ACTEX Learning Blog

Getting to Know Brian Fannin, Author of R for Actuaries and Data Scientists

Written by ACTEX Learning | Dec 30, 2020 3:00:00 PM

Brian has been programming since the mid-80’s when he taught a turtle how to walk with the Logo language. While in college, he learned how to use Fortran for computational physics to model harmonic oscillations and the movement of gas particles (among other things). After beginning his career as an actuary, he migrated to Visual Basic, which he used to automate various office tools like Excel, Access and Word. His proudest accomplishment is the creation of a self-destruct button in the console of a data support system for commercial general liability. (No actual harm befell anyone’s computer; the screen merely went blank for ten seconds.)

Brian first came across R in 2009, and became an active user over the next few years. After incorporating R in his day-to-day actuarial work, he began teaching others how to do the same as one of several instructors for R workshops and seminars offered by the Casualty Actuarial Society (CAS). A frequent speaker and instructor he has presented on R at numerous events on three continents. He is the author of the `raw`, and `RepResTools` packages, available on CRAN, as well as many other code examples on GitHub.

Brian has been an actuary since the mid-90’s, having begun his career coding Fortran routines to calculate defined benefit pensions. He switched over to general insurance shortly thereafter and has spent most of his career focused on commercial liability coverages. Over a decade of that time was spent in reinsurance, first in Chicago, then in Germany serving an international set of clients. He has been a staff actuary with the CAS since 2018. In addition to his duties there, Brian is the founder of PirateGrunt LLC, a niche consultancy focused on R training and predictive modeling for the insurance industry.

Brian lives in Durham, North Carolina with his wife and two children. When not programming, working, or writing, he cooks, blogs, travels, reads comic books, takes long walks, podcasts, rides roller coasters, and drinks coffee, though not necessarily in that order.

1. Why do actuaries and data scientists need to know R?
In theory, they don’t. One could use a spreadsheet, a general purpose stats environment like SAS, a general programming language like C++, or even pen and paper if they wanted. Actuaries and data scientists may not need R, but I think they’ll want it. R has included statistics as a core element from day one. The data structures and function set were built to quickly get sensible answers to statistical questions. This has lead to a global community that continues to add new features which incorporate the leading edge of data analytics.


2. How will this book help them learn it?
This book assumes no prior experience with R. We start with installation, getting acclimated to RStudio, and then we move on to basic stats, plotting and data structures. From there, we talk about advanced visualization, and some core models. Finally, we deal with workflow issues like data pre-processing, model validation, and utilities like Rmarkdown. You can start from nothing and get to be a practical, real-world, problem-solving R user from this text.


3. What sets this book apart from other books on R?
For one, this text is focused on insurance. It’s not the only one to do so, but it’s certainly a rarity. Second, I try to take a holistic, practical approach. The book has been informed by years of using R on the job where my primary interest is in keeping employers and clients happy. Those employers and clients have almost entirely been in the insurance space and the book reflects that perspective.


4. What is your experience using R?
I’ve been using it for about ten years. I learned by writing and then re-writing lots and lots of code. I spent many late nights sorting through documentation and trying things over and over again until they worked. This is the book that I wish I’d had for all those nights when I was learning. (It would have let me get some sleep!)


5. The SOA has an exam on predictive analytics that requires the use of R. Would this book help candidates prepare for this exam? If so, how would you suggest they use it?
Although this book wasn’t targeted for any particular exam or syllabus, it should be very useful. If nothing else, readers will get meaningful coverage of core predictive analytics topics like linear modeling, GLMs, decision trees, gradient boosting machines and random forests. There is also an entire chapter on the `caret` package for model evaluation.


6. Would this book help actuaries that received their qualifications a few years back get up to speed on R as well?
In the various workshops that I’ve co-instructed, attendees run the gamut, from early exam-takers to managers who are not that many years from retirement. This has informed an approach which teaches folks not just what they should be learning, but also why it makes sense to do things in R in a particular way. We’ve seen managers begin to appreciate the workflow advantages of switching from spreadsheets to code and from subjective heuristic methods to robust, statistically grounded models. Moreover, we try to hit the ground running with actual, practical code examples. We visualize statistical distributions in the second chapter, as soon as we’re done with installation.


7. A lot of people working in data science do not have a background in actuarial science, but are effectively working on actuarial problems. Would this book provide them the business context they need to do their job effectively?
I certainly hope so! The data is all publicly available, but it’s focused on life and non-life insurance. We consider things like tail events that are not as heavily emphasized in general data science texts. Yet tail events and risk management beyond central moments like the mean are a pretty big deal for insurance companies. We also have a chapter devoted solely to credibility in R. This is something that data scientists may not have come across, and almost certainly not using the same language that actuaries use. The bibliography will direct them to primary sources in the actuarial literature that may not be generally known.

R for Actuaries and Data Scientists is currently available! See the following link for details: https://www.actexmadriver.com/orderselection.aspx?id=453147402