# See the example in Mack's 1999 paper
Mortgage
MRT <- MackChainLadder(Mortgage, est.sigma="Mack", tail=1.05)
MRT
# Table 1
MRT$f
MRT$f.se
MRT$F.se[3,]
MRT$sigma
plot(MRT) # We observe trends along calendar years.
# See the Taylor/Ashe example in Mack's 1993 paper
GenIns
GNI <- MackChainLadder(GenIns, est.sigma="Mack")
GNI$f
GNI$sigma^2
GNI # compare to table 2 and 3 in Mack's 1993 paper
plot(GNI)
## Include a tail factor
GNIt <- MackChainLadder(GenIns, est.sigma="Mack", tail=TRUE)
## Extract more information on the tail factor
GNIt$tail
# This data set is discussed many papers, e.g. England and Verall 2000
# paper, see Table 1 just there
RAA
R <- MackChainLadder(RAA)
R
plot(R)
# Table 12 in England and Verall 2000 paper
R$f
R$sigma^2
# Table 13 in England and Verall 2000 paper
# Please note the different indexing of sigma
MackChainLadder(RAA, est.sigma=R$sigma[7])
# Table 14 in England and Verall 2000 paper
MackChainLadder(RAA, est.sigma=R$sigma[8])
# Different weights
# Using 1/Triangle^2 as weight will use mean chain ladder ratios
MackChainLadder(RAA, weights=1/RAA^2)$f
apply(RAA[,-1]/RAA[,-10],2, mean, na.rm=TRUE)
# Let's investigate the Mack model more detail
R[["Models"]][[1]] # Model for first development period
summary( R[["Models"]][[1]]) # Look at the model stats
op <- par(mfrow=c(2,2)) # plot residuals
plot( R[["Models"]][[1]])
par(op)
# Let's include an intercept in our model
newModel <- update(R[["Models"]][[1]], y ~ x+1,
weights=1/R[["Triangle"]][1:9,1],
data=data.frame(x=R[["Triangle"]][1:9,1],
y=R[["Triangle"]][1:9,2])
)
# View the new model
summary(newModel)
op <- par(mfrow=c(2,2))
plot( newModel )
par(op)
# Change the model for dev. period one to the newModel
R2 <- R
R2[["Models"]][[1]] <- newModel
predict(R2) # predict the full triangle with the new model
#(only the last origin year will be affected)
R2[["FullTriangle"]] <- predict(R2)
R2[["FullTriangle"]]
R2 # Std. Errors have not been re-estimated!
# Plot the result
plot(R2, title="Changed R Model")
##
Run the code above in your browser using DataLab