Linear Mixed Model in R: Rep. Measures, Nested, Random Effects

I ran a study with the following design: Subjects were presented 100 different stimuli and asked to indicate their liking (scaled from 0-10) for each stimulus. Each stimulus was part of only one of 4 different groups, thus it was a nested design (repeated measures for the different stimulus groups; within-subjects). Now I would like to conduct a linear mixed model analysis using the lmer function of the lme4 package in R, but as a newbie I am very insecure about my approach. I want to consider both random intercepts for stimuli and subjects and also allow random slopes for subjects.

I thought of the following model:

model = lmer(liking ~ group + (1|group/stimulus) + (1+group|subject), data=mydata)


Does this model make any sense?

• Since your response is bounded, wouldn't it make more sense to use beta regression of score/10? – Frans Rodenburg Oct 5 '18 at 11:18

1 Answer

Indeed, as Frans Rodenburg suggested, given that you have a bounded outcome you could fit a Beta mixed effects model. In addition, I think that you could start with a random intercept for subject and a random intercept for stimulus, i.e.,

liking ~ group + (1 | stimulus) + (1 | subject)


Such a model can be fitted with the glmmTMB package.