# load the package with the Tweedie distribution. This may have to be installed. library(statmod) #Read in the 2009 open claims data (latest evaluation) Open2009<-read.csv("c:/callpaper/2009 Open Claims.csv",sep=",") #Change the base level for Injury and Clmt.Age Open2009$Injury<-relevel(Open2009$Injury,"Other") Open2009$Clmt.Age<-relevel(Open2009$Clmt.Age,"26-45") #Create the GLM OpenGLM<-glm(Reserve~Accident.Year+Gender+Clmt.Age+Injury, data=Open2009, family=tweedie(var.power=2,link.power=0)) #Show the results of the GLM summary(OpenGLM) #Read in the data for all of the open claims at all evaluations OpenAll<-read.csv("c:/callpaper/All Open Claims.csv",sep=",") #Obtain the restated values for all of the open claims at all evaluations OpenRestated<-predict(OpenGLM,newdata=OpenAll,type='response') #set the number of digits to be written out options("digits"=10) #Write the restated values to a file write(OpenRestated,"c:/callpaper/Restated Claims.csv",sep=",",ncolumns=1)