Loss reserving has a new, silly name

I started using Git some time ago, but mostly for local work files. Today, I finally sync’ed up a repository for loss reserving analysis. It may be found here: https://github.com/PirateGrunt/MRMR

MRMR stands for Multivariate Regression Model for Reserves. When pronounced “Mister Mister” it also sounds like a thankfully forgotten American soft pop band from the ’80s (“Kyrie”, “Broken Wings”, etc.). It may also bring to mind MCMC, a subject that I’m trying to master in my spare time.

Current capabilities are:

  • Fetch NAIC data from the CAS research site.
  • Prepare a design matrix to fit a linear model.
  • Fit a weighted OLS regression to a loss triangle.
  • Write some basic diagnostic graphs to assess quality of the model.

This was some of the first R code that I wrote about a year ago and it’s been a while since I’ve looked at it. I expect I’ll be making loads of changes over the next few weeks. UPDATE: I tried to run the projection code this afternoon and got some incorrect results. At present, the projection function is pants. I hope to have it sorted out by the end of the weekend.

If you’d like to contribute, please let me know. I couldn’t possibly compete with ChainLadder. This is more just for fun and a convenient way to store and share code.

Here’s the demo script and a picture of the output.

source("https://raw.github.com/PirateGrunt/MRMR/master/RegressionSupport.r")
source("https://raw.github.com/PirateGrunt/MRMR/master/NAIC.R")
source("https://raw.github.com/PirateGrunt/MRMR/master/ReservingVisualization.R")
source("https://raw.github.com/PirateGrunt/MRMR/master/Triangle.R")

df = GetNAICData("wkcomp_pos.csv")
bigCompany = as.character(df[which(df$CumulativePaid == max(df$CumulativePaid)),"GroupName"])

df.BigCo = subset(df, GroupName == bigCompany)

df.UpperTriangle = subset(df.BigCo, DevelopmentYear <=1997)

tri = Triangle(TriangleData = df.UpperTriangle
               , TriangleName = bigCompany
               , LossPeriodType = "accident"
               , LossPeriodInterval = years(1)
               , DevelopmentInterval = years(1)
               , LossPeriodColumn = "LossPeriodStart"
               , DevelopmentColumn = "DevelopmentLag")

tri@TriangleName
tri

is(tri, "Triangle")
is.Triangle(tri)

plt = ShowTriangle(tri@TriangleData, bigCompany)

plot(tri)
head(LatestDiagonal(tri))
length(LatestDiagonal(tri)[,1])

plt = ShowTriangle(tri@TriangleData, bigCompany, Cumulative=FALSE)
#Note the apparent calendar year impact in 1996. This is invisible in the cumulative display.

AllstateCumulativePaid AllstateIncrementalPaid

About these ads

2 Responses to Loss reserving has a new, silly name

  1. catintp says:

    I was reading MRMR as “Murmur”, which usually goes along with loss reserving activity in most organizations. The actuaries murmur to themselves. The executives murmur about the actuaries and their numbers.

    Note: “Murmur” also has a 1980s inspiration. It is the title of an album by a band called R.E.M. (original release was on vinyl).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 273 other followers

%d bloggers like this: