report_sim {bage} | R Documentation |
Simulation Study of a Model
Description
Use simulated data to assess the performance of an estimation model.
Usage
report_sim(
mod_est,
mod_sim = NULL,
method = c("standard", "inner-outer"),
vars_inner = NULL,
n_sim = 100,
point_est_fun = c("median", "mean"),
widths = c(0.5, 0.95),
report_type = c("short", "long", "full"),
n_core = 1
)
Arguments
mod_est |
The model whose performance is being
assessed. An object of class |
mod_sim |
The model used to generate the simulated
data. If no value is supplied, |
method |
Estimation method used for |
vars_inner |
Variables used in inner model
with |
n_sim |
Number of sets of simulated data to use. Default is 100. |
point_est_fun |
Name of the function to use
to calculate point estimates. The options are |
widths |
Widths of credible intervals.
A vector of values in the interval |
report_type |
Amount of detail in return value.
Options are |
n_core |
Number of cores to use for parallel
processing. If |
Value
A named list with a tibble called "components"
and a
tibble called "augment"
.
Warning
The interface for report_sim()
is still under development
and may change in future.
See Also
-
mod_pois()
Specify binomial model -
mod_binom()
Specify binomial model -
mod_norm()
Specify normal model -
set_prior()
Specify non-default prior for term -
set_disp()
Specify non-default prior for dispersion -
fit()
Fit a model -
replicate_data()
Generate replicate data for a model
Examples
## 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)