## specify 'prob'
prob <- data.frame(sex = c("Female", "Male"),
mean = c(0.95, 0.97),
disp = c(0.05, 0.05))
## specify model
mod <- mod_pois(divorces ~ age * sex + time,
data = nzl_divorces,
exposure = population) |>
set_datamod_undercount(prob)
mod
## fit model
mod <- mod |>
fit()
mod
## original data, plus imputed values for outcome
mod |>
augment()
## parameter estimates
library(dplyr)
mod |>
components() |>
filter(term == "datamod")
## the data have in fact been confidentialized,
## so we account for that, in addition
## to accounting for undercoverage
mod <- mod |>
set_confidential_rr3() |>
fit()
mod
Run the code above in your browser using DataLab