I attached a data here called image_study. The “image_study.csv” dataset contains data from a study examining the speed of classification of two different types of image: artworks, and natural images. There are four variables in the data as follows:

participant – a unique identifier for each participant

image – a unique identifier for each image

image_type – a factor indicating whether a given image is an Artwork or a Natural image.

RT – reaction time in milliseconds

I want to model reaction times (RT) as a function of the other variables in the dataset. The purpose here is to examine the effect of Image-type on RT.

  1. Which of the fixed effect, random effect, or mixed effect model modes should I choose?
  2. Which participant or image variables should be considered as a random effect in the model? enter image description here enter image description here
  • $\begingroup$ @MrFlick I want to know the code related to R software about this question. $\endgroup$ Commented Jun 5, 2021 at 3:59
  • $\begingroup$ You need to choose a model first. R can't tell you which model to use or how to model your data (fix vs random effects). Those are statistical concerns, not programming concerns. You need to know what you want to do before you can write R code to do it. $\endgroup$
    – MrFlick
    Commented Jun 5, 2021 at 4:06
  • $\begingroup$ @MrFlick Both model selection and code writing in R are what I want. I also do not know what model to choose, nor do I know how to run it in R. (I am very familiar with R software). $\endgroup$ Commented Jun 5, 2021 at 4:10
  • $\begingroup$ What do you think is the appropriate model, given your data and question? $\endgroup$ Commented Jun 5, 2021 at 5:22
  • $\begingroup$ @AngelosAmyntas the crossed mixed effect model is the appropriate model for this question. $\endgroup$ Commented Sep 27, 2021 at 10:12

1 Answer 1


Since you say:

The purpose here is to examine the effect of Image_type on RT.

then we need a regression model with RT and the response and image_type as the main exposure (fixed effect).

Since you have repeated measure within both participant and image then you should fit random intercepts for both of these.

Furthermore, since participant and image appear to be crossed (from the data picture all images were seen by participant 1 and that appears to repeat for participant 2), then the following model should be appropriate:

RT ~ image_type + (1|participant) + (1|image)

which is the syntax you would use with popular R packages such as lme4. eg:

model <- lmer(RT ~ image_type + (1|participant) + (1|image), data = image_study
  • 1
    $\begingroup$ people often use identity-link Gamma models to model reaction time (I don't necessarily think this is a good idea, but they do it): glmer(..., family=Gamma(link="identity")) $\endgroup$
    – Ben Bolker
    Commented Jun 6, 2021 at 1:45
  • $\begingroup$ @BenBolker what is the default link function and distribution for random effect models? $\endgroup$ Commented Jun 6, 2021 at 4:15
  • $\begingroup$ See here for a discussion about the link function for gamma models $\endgroup$ Commented Jun 6, 2021 at 7:10
  • $\begingroup$ @BenBolker Indeed, I have seen that too, it often seems to arise from poorly fitting linear models, but I'm not sure the gamma models always improve things. For example here, here,and here $\endgroup$ Commented Jun 6, 2021 at 7:54
  • $\begingroup$ @MehdiLoohs generally Gaussian/identity $\endgroup$
    – Ben Bolker
    Commented Jun 6, 2021 at 15:19

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.