[R-sig-ME] separate variance-covariance matrix for each level of grouping variable
thom@@merk||ng00 @end|ng |rom gm@||@com
Fri Aug 23 13:44:51 CEST 2019
Thanks Ben for your reply,
glmmTMB(count ~ Trt + (0 + dummy(Trt, "0") + dummy(Trt, "0"):zAge |
patient) + (0 + dummy(Trt, "1") + dummy(Trt, "1"):zAge | patient), data =
which gave me similar SDs for the random intercepts and slopes as the brms
output but the correlations were 1 and -1 (see below) which is quite
different from the brms output (0.56 and -0.84).
Given that the correlations were exactly 1 and -1, I'm wondering if it is
the exact same fit as brms (count ~ Trt + (zAge|gr(patient, by = Trt)),
data = epilepsy), or if something differs in how the covariances are
Groups Name Variance Std.Dev. Corr
patient dummy(Trt, "0") 57.57 7.588
dummy(Trt, "0"):zAge 11.60 3.405 1.00
patient.1 dummy(Trt, "1") 103.60 10.178
dummy(Trt, "1"):zAge 38.37 6.194 -1.00
Residual 32.21 5.676
> 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
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models