I have an experimental array with a binary dependent variable. Each subject belongs to 1 of 3 groups. Each subject answers 10 questions, 5 of which belong to category A and 5 of which belong to category B. My goal is to examine the interaction between the group level and the category as well to examine the group and categories main effects. I'm using the glmer function from the lme4 package:

glmer(binary_outcome ~ category * group + (1|subject_ID), 

Does this formula capture the relevant aspects of the experimental array?


1 Answer 1


Since each subject answers questions from both categories, you should in principle allow for the among-subject variation in category effect:

binary_outcome ~ category * group + (category|subject_ID)

A couple of technical points you should be aware of:

  • you might find that the model is singular (i.e., you don't have enough information to fully estimate the among-subject variation in the category effect, which includes the variance in both categories and the correlation among categories). See e.g. the Barr et al. 2013 "keep it maximal" paper. If so, you could fall back to a random term of (1|subject_ID/category), which will be easier to estimate.
  • with 10 binary responses per individual, you probably should consider using Gaussian quadrature rather than the default Laplace approximation, e.g. nAGQ=10
  • $\begingroup$ I rarely answer questions about plm because I'm quite unfamiliar with the panel approach and its correspondence with the other flavors of mixed models ... it would usually take me some effort to get up to speed with the question ... $\endgroup$
    – Ben Bolker
    Jun 19, 2018 at 12:11
  • $\begingroup$ Thanks for your prompt and clear response. I appreciate the work you do here regardless! $\endgroup$
    – Eric Fail
    Jun 19, 2018 at 12:17

Your Answer

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

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