fit_mo_mo {StanMoMo} | R Documentation |
Wrapper function to fit and forecast mortality models
Description
Wrapper function to fit and forecast mortality models
Usage
fit_mo_mo(
mortality_model = "lc",
death,
exposure,
ages = 50:90,
validation = 0,
forecast = 1,
family = "nb",
chains = 1,
cores = 4,
log_marg = FALSE,
iter = 2000
)
Arguments
mortality_model |
name of the mortality model |
death |
death matrix |
exposure |
exposure matrix |
ages |
vector of ages |
validation |
size of the validation set |
forecast |
number of calendar years to be forecast |
family |
underlying count distribution |
chains |
number of Markov chains |
cores |
number of cores used |
log_marg |
Do we compute the marginal likelihood or not? |
iter |
Length of the Markov chain trajectory |
Value
a stanfit object
Examples
years <- 1990:2017
ages <- 50:90
cohorts <- sort(unique(as.vector(sapply(years, function(year) year - ages))))
death <- FRMaleData$Dxt[formatC(ages),formatC(years)]
exposure <- FRMaleData$Ext[formatC(ages),formatC(years)]
stan_fit <- fit_mo_mo("m6", death , exposure, ages, 0, 5, "nb", 1, 4,
log_marg = FALSE,iter=50)
boxplot_post_dist(stan_fit, "k", ages, years)
boxplot_post_dist(stan_fit, "g", ages, years)
[Package StanMoMo version 1.2.0 Index]