[R-sig-ME] Appropriate model reduction sequence for factorial design in glmmTMB

Phillip Alday ph||||p@@|d@y @end|ng |rom mp|@n|
Fri Apr 3 23:53:10 CEST 2020


Hi Maarten,

It's been a while and I still haven't had the time to give your post the
necessary thought to give you a proper answer ....

That said, Dimitri Rizopoulos posted some course notes a while back
(http://www.drizopoulos.com/courses/EMC/CE08.pdf). I found the
presentation there quite nice in terms of thinking about symmetry and
nesting structures. Emi Tanaka also has some great slides on "software
design for linear mixed model specification" which I also found great
for thinking about how these structures are represented in the syntax of
various software.

So I hope my non answer helps a bit ....

Phillip

On 22/10/19 10:01 pm, Maarten Jung wrote:
> Dear list,
>
> Sorry for basically restating my question here [1], but I think it
> might be worth a separate thread as it might well be much easier to
> answer with glmmTMB.
>
> After going through the posts [2] and [3] again, I identified the
> following nesting structure (arrows indicate nesting) as the one I
> want to go with for modelling some new data:
>
> m1 -> m2a/m2b/m2c -> m3 -> m4
>
> #######################################################
>
> library("lme4")
> data("Machines", package = "MEMSS")
> d <- Machines
> mat <- model.matrix(~ 0 + Machine, d)
> A <- mat[, 1]
> B <- mat[, 2]
> C <- mat[, 3]
>
> m1 <- lmer(score ~ Machine + (0 + Machine | Worker), d)
>
> m2a <- lmer(score ~ Machine + (1 | Worker) + (0 + dummy(Machine, "A")
> | Worker) +
>
>    (0 + dummy(Machine, "B") | Worker) +
>
>    (0 + dummy(Machine, "C") | Worker), d)
>
> m2b <- lmer(score ~ Machine + (1 | Worker) + (0 + A + B + C || Worker), d)
>
> m2c <- afex::lmer_alt(score ~ Machine + (1 | Worker) + (0 + Machine ||
> Worker), d)
>
> # m2a, m2b, and m2c are equivalent
> all.equal(logLik(m2a), logLik(m2b), logLik(m2c))
>
> m3 <- lmer(score ~ Machine + (1 | Worker) + (1 | Worker:Machine), d)
>
> m4 <- lmer(score ~ Machine + (1 | Worker), d)
>
> #######################################################
>
> In my new data there are multiple observations per cell of a (at
> least) 2x3 within-subjects design.
> I know that m1 (denoting the two factors with f1 and f2, respectively)
> would look like
>
> lmer(y ~ f1*f2 + (1 + f1*f2 | subject), data)
>
> and I think like this in glmmTMB syntax
>
> glmmTMB(y ~ f1*f2 + us(f1*f2 | subject), data, REML = TRUE)
>
> So now I'm struggling to figure out what m2a (or m2b/m2c) and m3 would
> look like in the (at least) 2-factorial case.
> My guess is that m2 would look like this in glmmTMB syntax
>
> glmmTMB(y ~ f1*f2 + (1 | subject) + diag(0 + f1*f2 | subject), data,
> REML = TRUE)
>
> and that this might correspond to the following afex:lmer_alt() model
>
> afex::lmer_alt(y ~ f1*f2 + (1 | subject) + (0 +  f1*f2 || subject ), data)
>
> But I'm not sure about m3.
>
> I would be grateful if someone could provide the appropriate glmmTMB
> syntax (additionally or alternatively, lmer/afex::lmer_alt syntax is
> still welcome in the other thread).
>
> Best,
> Maarten
>
> [1] https://stat.ethz.ch/pipermail/r-sig-mixed-models/2019q4/028222.html
> [2] https://stat.ethz.ch/pipermail/r-sig-mixed-models/2018q2/026775.html
> [3] https://stats.stackexchange.com/questions/345842/what-is-the-appropriate-zero-correlation-parameter-model-for-factors-in-lmer
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



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