Skip to content

Instantly share code, notes, and snippets.

View PirateGrunt's full-sized avatar
💭
coding

Brian Fannin PirateGrunt

💭
coding
View GitHub Profile
@PirateGrunt
PirateGrunt / ClusteredDevelopmentLags
Last active December 13, 2015 19:09
Clustered development lags
data(NAIC)
bigCompany = as.character(NAIC[which(NAIC$CumulativePaid == max(NAIC$CumulativePaid)),"GroupName"])
df.BigCo = subset(NAIC, GroupName == bigCompany)
df.UpperTriangle = subset(df.BigCo, DevelopmentYear <=1997)
MeasureName = colnames(df.UpperTriangle)[5:10]
MeasureMeta = data.frame(MeasureName = as.character(MeasureName), Cumulative = as.character(c(rep("Cumulative", 2), rep("Neither", 4))))
rm(MeasureName)
@PirateGrunt
PirateGrunt / MRMR Triangle constructor
Created January 24, 2013 14:56
MRMR Triangle constructor
#==================================================================================================
# User-friendly constructor
# This is a giant pile of code which basically does the following:
# * Ensure that we have a proper date for the loss period start
# * Ensure that we have a column for the development lag
# * Once those have been established, create columns for loss period start and end, create a column
# for development period (based on lubridate Period class), compute the evaluation date.
Triangle = function(TriangleData
, TriangleName
, LossPeriodType = "accident"