Compares observed response rates against simulated response rates from a
model, stratified by a grouping variable. This function is model-agnostic:
it operates purely on data frames. The sim data frame is expected to
contain one row per simulated observation per replicate, with a sim_id
column identifying each replicate (see e.g. erglm::erglm_vpc_sim() for one
way to generate such simulations from a fitted model).
Arguments
- data
Observed data
- sim
Simulated data, with the same
exposure/response/group_bycolumns asdata, plus asim_idcolumn identifying each replicate- exposure
Exposure variable (one variable, unquoted)
- response
Response variable (one variable, unquoted). Assumed to be binary (0/1)
- group_by
Variable (unquoted) to stratify predictions
- conf_level
Confidence level
Examples
if (FALSE) { # \dontrun{
library(erglm)
mod <- erglm_model(ae2 ~ aucss + sex, erglm_data, family = binomial())
sim <- erglm_vpc_sim(mod)
er_vpc_plot(erglm_data, sim, aucss, ae2, group_by = aucss)
er_vpc_plot(erglm_data, sim, aucss, ae2, group_by = sex)
} # }