I am analysing data from a medication study. Participants did the same task twice; in one session they were given a certain drug and a placebo in the other one. The order of the sessions was perfectly counterbalanced, meaning that some participants did the drug condition first whereas others participated in the placebo condition first. Therefore, we have repeated measures data from each participant in both conditions. In the task, we assume that three different factors (delay, reward magnitude and previous choice) influence current choice. I used to fit a logistic regression model and compared the regression weights between conditions with a 2x2 ANOVA (drug x order). However, for various reasons I would rather analyse the same data with a linear mixed model in R. Since I am new to mixed model analysis, I would love to hear your opinions on how I set up the model. As I said, we are specifically interested in how the drug affects the influence of reward parameters on choice. For example: Does the delay has a different influence on choice given drug vs/placebo, so the interaction between both. I set up the model in the following way: Choice~1+ delay*drug+reward_mag:drug+previous_choice:drug+reward_mag+previous_choice+(1+delay+reward_mag+previous_choice+drug+session| subj). I was specifically wondering whether I would need to specify the interaction effects as random effects as well?

Every help would be vry much appreciated!




1 Answer 1


The model:

Choice~1+ delay*drug+reward_mag:drug+previous_choice:drug+reward_mag+previous_choice+(1+delay+reward_mag+previous_choice+drug+session| subj)

has a very complex random structure. It would not surprise me if it converges with a singular fit or some other problem. But you might be lucky. Do you have a priori reasons to think that all the main effects should vary by subject ?

If you have reason to believe that the interactions should also vary by subject then of course you can also include them in the random structure, but again, don't be surprised if you get convergence problems.

  • $\begingroup$ Hi, thanks for your answer! Unfortunately, I do have a priori reasons to assume that they all differ by participant. However, I indeed end up with a singular fit :( What I am now trying to do is to include random intercepts for the interaction effects and to include random effects systematically as long as the AIC is minimized (Barr et al.,2013). Thats the only solution I came up with so far. $\endgroup$
    – Laurie
    Aug 4, 2020 at 10:53
  • 1
    $\begingroup$ Ahhhh ! That "Keep it Maximal" paper is responsible for nearly all the questions on here from people trying to fit models that are hopelessly over-parameterised in the random effects that won't converge properly. People should read "Parsimonious Mixed Models" by Bates (who is the primary author of lme4) instead (or as well as). Even if you think there is reason for fixed effects to vary by subject it is absolutely fine to stick with random interecepts only. $\endgroup$ Aug 4, 2020 at 11:05
  • $\begingroup$ Also what do you mean by "What I am now trying to do is to include random intercepts for the interaction effects" ? $\endgroup$ Aug 4, 2020 at 11:33
  • $\begingroup$ I was trying to do sth like that: choice ~1+delay* drug* reward_mag*previous_choice+(1|sub)+(1|sub:delay)+(1|sub:drug) (etc) and include those random interecepts for the interaction effects systematically as long as the AIC is going down. But after I read your comment I will try to go with only the (1|sub) term first and see what happens when I include the other intercepts. Does that make sense? $\endgroup$
    – Laurie
    Aug 4, 2020 at 12:03
  • 1
    $\begingroup$ Hmmm. That's OK if you have reason to believe that there is additional variation for these interactions that is not captured by the random intercepts for subject, but if it's just speculative and you are fishing for a lower AIC then this isn't a god idea. Have you read my answer here which is quite relevant to this ? $\endgroup$ Aug 4, 2020 at 12:25

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.