For each exposure the dataset is copied and the original value replaced by the reference value. Then the sim function is used to generate 500 simulations of expected responses for each row. Finally the dataset is transformed to obtain expected response for original and reference values of the given exposures for each original row of the dataset.
Arguments
- fit
A model fit constructed by fit_attrib
- data
The observed data
- exposures
The exposures that will get reference expected mortalities
- n_sim
Number of simulations
For more details see the help vignette:
vignette("intro", package="attrib")
Value
Dataset with expected responses for all simulations including expected responses given the exposure reference values
Examples
if (FALSE) {
response <- "deaths_n"
fixef <- "ili_isoweekmean7_13_pr100 +
sin(2 * pi * (isoweek - 1) / 52) +
cos(2 * pi * (isoweek - 1) / 52)"
ranef <- " (ili_isoweekmean7_13_pr100| season)"
offset <- "log(pop)"
data <- attrib::data_fake_attrib_nation
fit <- fit_attrib(data = data, response = response, fixef = fixef, ranef = ranef, offset = offset)
exposures <- c(ili_isoweekmean7_13_pr100 = 0)
n_sim <- 5
new_data <- est_attrib(fit, data, exposures, n_sim)
new_data[]
}