## results random, so set seed
set.seed(0)
## make data - outcome variable (deaths here)
## needs to be present, but is not used
data <- data.frame(region = c("A", "B", "C", "D", "E"),
population = c(100, 200, 300, 400, 500),
deaths = NA)
## simulation with estimation model same as
## data-generating model
mod_est <- mod_pois(deaths ~ region,
data = data,
exposure = population) |>
set_prior(`(Intercept)` ~ Known(0))
report_sim(mod_est = mod_est,
n_sim = 10) ## in practice should use larger value
## simulation with estimation model different
## from data-generating model
mod_sim <- mod_est |>
set_prior(region ~ N(s = 2))
report_sim(mod_est = mod_est,
mod_sim = mod_sim,
n_sim = 10)
Run the code above in your browser using DataLab