Converts a design matrix + key variables into a common format In particular this function does the following:
Renames all covariates as
V1
,V2
, etc to avoid issues of special characters in variable namesEnsures all key variables are of the right type
Inserts the outcome, visit and subjid variables into the
data.frame
naming them asoutcome
,visit
andsubjid
If provided will also insert the group variable into the
data.frame
named asgroup
Arguments
- designmat
a
data.frame
ormatrix
containing the covariates to use in the MMRM model. Dummy variables must already be expanded out, i.e. viastats::model.matrix()
. Cannot contain any missing values- outcome
a numeric vector. The outcome value to be regressed on in the MMRM model.
- visit
a character / factor vector. Indicates which visit the outcome value occurred on.
- subjid
a character / factor vector. The subject identifier used to link separate visits that belong to the same subject.
- group
a character / factor vector. Indicates which treatment group the patient belongs to.