1
$\begingroup$

Searching previous threads has not provided me with an answer. I am modelling data from an experiment. The setup was as follows: Stimulus set of 110 images. 454 participants. Each participants rated 75 images (random from the pool of 110) and reported visual appeal.

Two measures of the images (visual clutter and colourfulness) are shown to have moderate to high correlation with visual appeal. I therefore want to include them in the model. I want to use both subjectID and stimulus (filename of stimulus) as a random effect. In R, using lme4, I enter:

ae.model = lmer(ae_rating ~ clutter_se + colourfulness + (1|subjectID) + (1|stimulus), data=lmm.data)

and get "Error: number of levels of each grouping factor must be < number of observations:". There is probably something I am not completely understanding about using mixed effects models. Does the above code somehow nest the random effects? Then I would understand the error (as subjects*stimuli > observations).

$\endgroup$
  • $\begingroup$ If you do not get a response here I would suggest the R mailing list dedicated to mixed models. $\endgroup$ – mdewey Aug 16 '17 at 13:55
  • 1
    $\begingroup$ Does the above code somehow nest the random effects? - No. The error message is strange. Double-check that lmm.data contains all the data. Can you post summary(lmm.data) or something similar that shows the number of rows and the number of levels of stimulus and subjectID? $\endgroup$ – amoeba Aug 16 '17 at 14:16
  • $\begingroup$ The problem is solved. Summarizing identified that there were 111 levels of stimulus, somewhere in the data processing "test1" was in some places changed to "1". Model works now! Thanks. $\endgroup$ – Jelte van Boheemen Aug 18 '17 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.