gcomp_responder_multi {rbmiUtils} | R Documentation |
G-computation for a Binary Outcome at Multiple Visits
Description
Applies gcomp_responder()
separately for each unique visit in the data.
Usage
gcomp_responder_multi(data, vars, reference_levels = NULL, ...)
Arguments
data |
A data.frame containing multiple visits. |
vars |
A list specifying analysis variables. |
reference_levels |
Optional reference level for the treatment variable. |
... |
Additional arguments passed to |
Value
A named list of estimates for each visit and treatment group.
Examples
library(dplyr)
library(rbmi)
library(rbmiUtils)
data("ADMI")
ADMI <- ADMI |>
mutate(
TRT = factor(TRT, levels = c("Placebo", "Drug A")),
STRATA = factor(STRATA),
REGION = factor(REGION)
)
# Note: method must match the original used for imputation
method <- method_bayes(
n_samples = 100,
control = control_bayes(warmup = 20, thin = 2)
)
vars_binary <- set_vars(
subjid = "USUBJID",
visit = "AVISIT",
group = "TRT",
outcome = "CRIT1FLN",
covariates = c("BASE", "STRATA", "REGION")
)
ana_obj_prop <- analyse_mi_data(
data = ADMI,
vars = vars_binary,
method = method,
fun = gcomp_responder_multi,
reference_levels = "Placebo",
contrast = "diff",
var_method = "Ge",
type = "HC0"
)
pool(ana_obj_prop)
[Package rbmiUtils version 0.1.4 Index]