[R] Defining interaction in random effects in lme4

Dominik Ćepulić dcepulic at gmail.com
Sun Jan 7 15:46:00 CET 2018


Dear everybody!

My fixed-effects-only model looks like this: glmer(Accuracy ~ C.RT*Group,
data = da)

C.RT is the reaction time variable, and Group is a categorical variable
with 0 and 1 as values. I would like to specify that main intercept, Group
intercept, C.RT slope and C.RT*Group slope vary across subjects and trials.

All subjects have values in Group = 0 and in Group = 1. Trials are nested
within Group because each trial belongs either to Group = 0 or Group = 1.
How should I specify the model?

My ideas were:

   1. glmer(Accuracy ~ C.RT*Group + (C.RT*Group|subject) + (1+C.RT|trial),
   data = da)

or
    2. glmer(Accuracy ~ C.RT*Group + (1+C.RT|Group:subject) +
(1+C.RT|Group:trial), data = da)

Here, Group:trial does not make much sense as trials are *per se* divided
in Group 0 or Group 1.

What is, in your opinion, the best way to specify the model that I want to
test?

Additionally, the difference between (1+C.RT|Group:subject) and
(C.RT*Object|subject) is not clear to me. Can someone also shed some light
here?

Thanks,
Dominik!

	[[alternative HTML version deleted]]



More information about the R-help mailing list