This builds the model formula which is used inside fit_mmrm_j() and provided
to mmrm::mmrm() internally. It can be instructive to look at the resulting
formula directly sometimes. In particular, if a subgroup variable is included
in vars, then the formula will include the interaction of subgroup with
arm and visit.
Usage
build_formula(
vars,
cor_struct = c("unstructured", "toeplitz", "heterogeneous toeplitz", "ante-dependence",
"heterogeneous ante-dependence", "auto-regressive", "heterogeneous auto-regressive",
"compound symmetry", "heterogeneous compound symmetry")
)Value
Formula to use in mmrm::mmrm().
Examples
vars <- list(
response = "AVAL",
covariates = c("RACE", "SEX"),
id = "USUBJID",
arm = "ARMCD",
visit = "AVISIT",
subgroup = "REGION"
)
build_formula(vars, "auto-regressive")
#> AVAL ~ RACE + SEX + ARMCD * AVISIT * REGION + ar1(AVISIT | USUBJID)
#> <environment: 0x55c667421990>
build_formula(vars)
#> AVAL ~ RACE + SEX + ARMCD * AVISIT * REGION + us(AVISIT | USUBJID)
#> <environment: 0x55c655f49e08>
