rbmi_mmrm {junco} | R Documentation |
MMRM Analysis for Imputed Datasets
Description
Performs an MMRM for two or more groups returning the estimated 'treatment effect' (i.e. the contrast between treatment groups and the control group) and the least square means estimates in each group.
Usage
rbmi_mmrm(
data,
vars,
cov_struct = c("us", "toep", "cs", "ar1"),
visits = NULL,
weights = c("counterfactual", "equal"),
...
)
Arguments
data |
( |
vars |
( |
cov_struct |
( |
visits |
( |
weights |
( |
... |
additional arguments passed to |
Details
The function works as follows:
Optionally select the subset of the
data
corresponding to 'visits.Fit an MMRM as
vars$outcome ~ vars$group + vars$visit + vars$covariates
with the specified covariance structure for visits within subjects.Extract the 'treatment effect' & least square means for each treatment group vs the control group.
In order to meet the formatting standards set by rbmi::analyse()
the results will be collapsed
into a single list suffixed by the visit name, e.g.:
list( var_B_visit_1 = list(est = ...), trt_B_visit_1 = list(est = ...), lsm_A_visit_1 = list(est = ...), lsm_B_visit_1 = list(est = ...), var_B_visit_2 = list(est = ...), trt_B_visit_2 = list(est = ...), lsm_A_visit_2 = list(est = ...), lsm_B_visit_2 = list(est = ...), ... )
Please note that 'trt' refers to the treatment effects, and 'lsm' refers to the least
square mean results. In the above example vars$group
has two factor levels A and B.
The new 'var' refers to the model estimated variance of the residuals at the given
visit, together with the degrees of freedom (which is treatment group specific).
If you want to include additional interaction terms in your model this can be done
by providing them to the covariates
argument of rbmi::set_vars()
e.g. set_vars(covariates = c('sex*age'))
.
Value
a list of variance (var_*
), treatment effect (trt_*
), and
least square mean (lsm_*
) estimates for each visit, organized as
described in Details above.
Note
The group
and visit
interaction group:visit
is not included by
default in the model, therefore please add that to covariates
manually if
you want to include it. This will make sense in most cases.