[R-sig-ME] glmmTMB: fit mixed model with different covariance between two groups

Noci, Alessandro @|e@@@ndro@noc| @end|ng |rom roche@com
Mon Nov 16 17:26:20 CET 2020


Hi all,

I am interested in fitting a linear mixed model with different unstructured
covariance between the two arms.

To give you an idea, suppose that I have longitudinal data related to
patients belonging to two different arms in a clinical trial. The dataset
has the following variables:

   1. *id*: the id of the patients.
   2. *group*: 2 levels factor indicating which arm each patient belongs to.
   3. *time: *time-variable.
   4. *var1:* baseline covariate.
   5. *y: *outcome variable.

# simulate data (toy example)

set.seed(123)
data = data.frame("id" = rep(1:40, each = 4), "group" = factor(rep(c(0,1),
each = 20*4)), "time" = factor(rep(1:4, 40)), "var1" = rnorm(40*4), "y" =
rnorm(40*4))

I can fit a linear mixed model with unstructured covariance calling:

# fit model

fit = glmmTMB(y ~ time*group + us(0 + time | id), data = data, dispformula
= ~0, REML = TRUE, control=
glmmTMBControl(optimizer=optim,optArgs=list(method="L-BFGS-B")))

However this is assuming that the covariance matrices of the two groups are
identical. I would like to fit the model assuming a
different (unstructured) covariance matrix for each arm and extract the two
estimated covariance matrices. Is it possible to do this?

Best,
Alessandro

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list