# NOT RUN {
#Long computing times
# }
# NOT RUN {
#Lee-Carter: Compare projection with and without parameter uncertainty
library(fanplot)
LCfit <- fit(lc(), data = EWMaleData)
LCResBoot <- bootstrap(LCfit, nBoot = 500)
LCResBootsim <- simulate(LCResBoot)
LCsim <- simulate(LCfit, nsim = 500)
plot(LCfit$years, log(LCfit$Dxt / LCfit$Ext)["10", ],
xlim = range(LCfit$years, LCsim$years),
ylim = range(log(LCfit$Dxt / LCfit$Ext)["10", ],
log(LCsim$rates["10", , ])),
type = "l", xlab = "year", ylab = "log rate",
main = "Mortality rate projection at age 10 with and without parameter uncertainty")
fan(t(log(LCResBootsim$rates["10", , ])),start = LCResBootsim$years[1],
probs = c(2.5, 10, 25, 50, 75, 90, 97.5), n.fan = 4,
fan.col = colorRampPalette(c(rgb(0, 0, 1), rgb(1, 1, 1))), ln = NULL)
fan(t(log(LCsim$rates["10", 1:(length(LCsim$years) - 3), ])),
start = LCsim$years[1], probs = c(2.5, 10, 25, 50, 75, 90, 97.5),
n.fan = 4, fan.col = colorRampPalette(c(rgb(1, 0, 0), rgb(1, 1, 1))),
ln = NULL)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab