[R-sig-ME] separate variance-covariance matrix for each level of grouping variable

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Thu Aug 22 15:44:03 CEST 2019

count ~ Trt + (0 + dummy(Trt, "Trt0"):zAge | patient) +
              (0 + dummy(Trt, "Trt1"):zAge | patient)

might work in either glmmTMB or lme4.  The dummy() function (which is in
the lme4 package, you may need to load it even if you're using glmmTMB)
is 'sugar' for creating a numeric dummy variable.  An interaction with a
numeric variable corresponds to multiplying the interacting term by the
variable, so (for example) the first term is zero except for
observations in Trt0.

  This hack gets awkward if you have lots of groups (although you can
always construct the formula programmatically).

   In lme4 you may have to use lmerControl() to override some of the
checks that there aren't too many random-effects levels.

  Ben Bolker

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