I am trying to specify a linear mixed model using lme4, and do not completely understand how to specify a crossed random effects structure.
The study design looks like this:
- we have n subjects (
id
) - who were measured twice (
time
: Pre, Post) - in both legs (
leg
: Dominant, Non-Dominant) - and in each measurement (
id:time:leg
) we took the same measurement 5 times (sample
).
I am interested in the effect of time, leg and their interaction. However, as far as I understand, there are some crossed random effects I should take care of, since both explanatory variables have been measured within the same participants... So here begin my doubts:
- Is the following model specification correct?
lmer(value ~ time * leg + (1 | id) + (1 | id:leg) + (1 | id:time), data)
Is it reasonable in this case to specify the same variables as fixed as well as random effects?
If not, what alternatives should I consider?
I struggle to understand too, whether I should specify a random intercepts-only model, or include random slopes as well. This might be too much to ask but... could you help me understand the practical difference between random slopes for time
(time | id)
versus crossed random intercepts for id and time(1 | id) + (1 | id:time)
in this example?
Thank you in advance