Fits a MMRM model allowing for different covariance structures using mmrm::mmrm()
.
Returns a list
of key model parameters beta
, sigma
and an additional element failed
indicating whether or not the fit failed to converge. If the fit did fail to converge
beta
and sigma
will not be present.
fit_mmrm(
designmat,
outcome,
subjid,
visit,
group,
cov_struct = c("us", "ad", "adh", "ar1", "ar1h", "cs", "csh", "toep", "toeph"),
REML = TRUE,
same_cov = TRUE
)
a data.frame
or matrix
containing the covariates to use in the MMRM model.
Dummy variables must already be expanded out, i.e. via stats::model.matrix()
. Cannot contain
any missing values
a numeric vector. The outcome value to be regressed on in the MMRM model.
a character / factor vector. The subject identifier used to link separate visits that belong to the same subject.
a character / factor vector. Indicates which visit the outcome value occurred on.
a character / factor vector. Indicates which treatment group the patient belongs to.
a character value. Specifies which covariance structure to use. Must be one of "us"
(default),
"ad"
, "adh"
, "ar1"
, "ar1h"
, "cs"
, "csh"
, "toep"
, or "toeph"
)
logical. Specifies whether restricted maximum likelihood should be used
logical. Used to specify if a shared or individual covariance matrix should be
used per group