View source: R/fit_mortality_model.R
boxplot_post_dist | R Documentation |
The function generates boxplots for the posterior distribution of the main parameters
boxplot_post_dist(stan_fit, parm_name, ages, years)
stan_fit |
stan fit object |
parm_name |
string to indicate the name of the parameter, to choose from c('a', 'b', 'g', 'k', 'k2', 'phi') |
ages |
range of ages |
years |
range of years |
Posterior distribution shown as boxplots
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)]
iterations<-50 # Toy example, consider at least 2000 iterations
stan_fit <- fit_mo_mo("m6", death , exposure, ages, 0, 5, "nb", 1, 4,
log_marg = FALSE,iter=iterations)
boxplot_post_dist(stan_fit, "k", ages, years)
boxplot_post_dist(stan_fit, "g", ages, years)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.