Helpers for Processing Least Square Means
h_get_emmeans_res(fit, vars, weights)h_get_average_visit_specs(emmeans_res, vars, averages, fit)
h_get_spec_visit_estimates(emmeans_res, specs, conf_level, tests = FALSE, ...)
h_get_single_visit_estimates(emmeans_res, conf_level)
h_get_relative_reduc_df(estimates, vars)
h_single_visit_contrast_specs(emmeans_res, vars)
h_average_visit_contrast_specs(specs, averages)
result of model fitting function, e.g. mmrm::mmrm() or stats::lm().
(named list of string or character)
specifying the variables in the MMRM.
The following elements need to be included as character vectors and match corresponding columns
in data:
response: the response variable.
covariates: the additional covariate terms (might also include interactions).
id: the subject ID variable.
arm: the treatment group variable (factor).
visit: the visit variable (factor).
weights: optional weights variable (if NULL or omitted then no weights will be used).
Note that the main effects and interaction of arm and visit are by default
included in the model.
(string)
argument from emmeans::emmeans(), 'counterfactual' by default.
(list)
initial emmeans result from h_get_emmeans_res().
(list)
optional named list of visit levels which should be averaged
and reported along side the single visits.
(list)
list of least square means specifications, with
elements coefs (coefficient list) and grid (corresponding data.frame).
(proportion)
confidence level of the interval.
(flag)
whether to add test results to the estimates.
additional arguments for emmeans::contrast().
(data.frame)
single visit least square mean estimates.
h_get_emmeans_res(): returns a list with
object (emmGrid object containing emmeans results) and grid
(data.frame containing the potential arm and the visit variables
together with the sample size n for each combination).
h_get_average_visit_specs(): constructs average of visits specifications.
h_get_spec_visit_estimates(): estimates least square means as a data.frame
given specifications.
h_get_single_visit_estimates(): estimates least square means for single visits.
h_get_relative_reduc_df(): constructs data.frame with
relative reduction vs. reference arm based on single visit estimates.
h_single_visit_contrast_specs(): constructs single visit contrast specifications.
h_average_visit_contrast_specs(): constructs average visits contrast specifications,
given the specs for single visit contrasts and the averages required.