data(GenIns)
GenIns <- GenIns / 1000
# over-dispersed Poisson: reproduce ChainLadder estimates
(fit1 <- glmReserve(GenIns))
summary(fit1, type = "model") # extract the underlying glm
# Gamma GLM:
(fit2 <- glmReserve(GenIns, var.power = 2))
# compound Poisson GLM (variance function estimated from the data):
#(fit3 <- glmReserve(GenIns, var.power = NULL))
# Now suppose we have an exposure measure
# we can put it as an offset term in the model
# to do this, use the "exposure" attribute of the 'triangle'
expos <- (7 + 1:10 * 0.4) * 100
GenIns2 <- GenIns
attr(GenIns2, "exposure") <- expos
(fit4 <- glmReserve(GenIns2))
# use bootstrapping to compute prediction error
set.seed(11)
(fit5 <- glmReserve(GenIns, mse.method = "boot"))
# compute the quantiles of the predicted loss reserves
t(apply(fit5$sims.reserve.pred, 2, quantile,
c(0.025, 0.25, 0.5, 0.75, 0.975)))
Run the code above in your browser using DataLab