What type of factors can be used as random effects in mixed linear regression? I am working on a picture naming task. Subjects named pictures as quickly as possible. Some images appear more times, while others appear once or twice. Therefore, we include the number of times the image is present as a fixed effect. I was told to use the trail ID as a random effect instead of the image ID.

For example: subject saw the images in this sequence: Pic A, Pic E, Pic B, Pic A, Pic C.... The Trail ID is 1, 2, 3, 4, 5.... As you can see, the number of trail ID equals the number of observations.

I would like to know why the trail ID is used as a random effect, is this a good approach? Or does it depend on the influence of the trail sequence, e.g. if Pic A comes before Pic D, then the influence might be different than Pic E that comes before Pic D?


1 Answer 1


I'm going to assume that when you say "random effect", you mean "random intercept" - that is, the intercept term is allowed to vary between levels of your factors. I'm also assuming your dependant variable is accuracy.

Including random intercepts for a particular factors means allowing average accuracy to differ between different levels of this factor.

  • You should always include random intercepts by participant, since some participants will be more accurate than other.
  • You almost always want random intercepts by picture, because some pictures are easier to name than others.
  • Random intercepts by trial number would mean that people are more likely to be accurate on some trial numbers than others, regardless of what picture was shown. This sounds plausible enough, but I would expect any such differences to be much smaller than differences between participants and pictures.

The general approach here is to fit a model with all of the relevant random effects (participants, pictures, and trial numbers), and to simplify it by removing less important factors if the full model doesn't converge (which is likely to be the case). There are data-driven ways of finding out which factors are most important, but you should also just use your head - clearly the effect of trial numbers is going to be least important one here!

  • $\begingroup$ Thank you for your reply. I agree with you that Image ID is more important than trail ID. But when I put the subject, image id, and trail ID into the model, I found that subject had the highest variance, followed by the trail ID, and surprisingly, the image id has the lowest variance. Does that mean the trail ID is more important than the image id in this case (although I don't think that makes sense)? $\endgroup$
    – Ann Li
    Feb 16, 2022 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.