RAA
MCL=MackChainLadder(RAA)
MCL
plot(MCL)
MCL[["Models"]][[1]] # Model for first development period
summary( MCL[["Models"]][[1]]) # Look at the model stats
op=par(mfrow=c(2,2)) # plot residuals
plot( MCL[["Models"]][[1]])
par(op)
# Let's include an intercept in our model
newModel <- update(MCL[["Models"]][[1]], y ~ x+1,
weights=1/MCL[["Triangle"]][1:9,1],
data=data.frame(x=MCL[["Triangle"]][1:9,1],
y=MCL[["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
MCL2=MCL
MCL2[["Models"]][[1]] = newModel
predict(MCL2) # predict the full triangle with the new model
#(only the last origin year will be affected)
MCL2[["FullTriangle"]] <- predict(MCL2)
MCL2[["FullTriangle"]]
MCL2 # Std. Errors have not been re-estimated!
# plot the res
plot(MCL2, title="Change MCL Model")
Run the code above in your browser using DataLab