I'm trying to recapitulate a statistical analysis based on a written description of an MMRM used to fit a patient data set.
The description is as follows:
Dependent variable: area (continuous, float)
Independent variables:
- arm: 2 level factor
- study_part: 2 level factor
- m1: 2 level factor
- m2: 2 level factor
- m3: 2 level factor
- visit: 3 level factor | random effect with unstructured correlation
- Interaction terms between visit and all other factors | random effect
The above needs to be implemented in R, but I'm not as familiar with R syntax.
Currently I've arrived at:
mmrm <- lme(area ~ arm*visit + study_part*vist + m1*visit + m2*visit + m3*visit,
data = data,
method = "REML",
na.action = na.omit,
random = ~visit | pt_id #pt_id is to indicate random effect to be grouped by patient
correlation = corSymm(form = ~visit | pt_id),
weights = varIdent(form = ~1|vist),
control = lmeControl(msMaxIter = 200, opt = "optim")) #optim seems to be the preffered method, though not the default
My question is 3-fold:
With the above structure are visit and the related interaction terms being correctly handled as random effects?
My understanding of R is that when stating a covariate of the form
arm*visit
that the packaged will include terms forarm
,visit
, andarm*visit
, where arm will be a fixed effect and the remaining 2 terms will be random - is this correct?If the above structure is not correct - any suggestions on how to more correctly structure would be helpful
arm*visit
that will just be fixed effects. By the way, with MMRM people often mean a model with a particular correlation structure between visits - such as unstructured to reflect that an equal correlation (as you use above) between visits is less likely and visits that are further apart should be "given the option" to be less correlated. People also often want a particular method for the denominator degrees of freedom (such as Kenward-Rogers), anything like that needed? $\endgroup$visit
(similar to your variable 7) while accounting for correlations in error estimates. $\endgroup$