I face a challenge in running a model comprising (1) crossed random effects and (2) a zero-inflated negative binomial regression in R.

In the study, I analyze interactions between organizations. Specifically, I check how often x dyads of organizations supported each other. For instance, how often did organization A (sender) support organization B (receiver)? Next, how often did organization B support organization A? The data structure looks like this:

enter image description here

Given that all organizations in the sample once interact with one another, it seems to be a case of crossed level effects. Furthermore, since the dependent data is a count variable (e.g., number of times one orga A supports B) with excessive amounts of zeros (many observations with no support), I think a zero-inflated negative binomial regression analysis needs to be employed.

So far, I discovered syntaxes for either crossed-level effects or negative binomial regression analyses. However, I did not find a syntax that integrates both kinds of analyses. Please find below these syntaxes. Are they compatible and how can they be merged? Furthermore, I am wondering how simple slopes tests can be conducted for these kinds of models to test the interaction. I would be extremely grateful for your advice. Many thanks in advance.


lmer(Support ~ IncomeSender * IncomeReceiver + (1|SupportSender) + (1|SupportReceiver))

multilevel negative binomial regression with the GLMMadaptive package; not sure which values should be inserted for random and fixed.

gm1 <- mixed_model(Support ~ IncomeSender * IncomeReceiver, random = ~ ? | SupportSender, data = DF,family = zi.negative.binomial(), zi_fixed = ?)


1 Answer 1


As far as I know, at the moment package GLMMadaptive does not support crossed random effects.

So the approach you used with lmer is correct in terms of the crossed random effects, but in order to handle zero inflated responses with a negative binomial distribution, you could consider packages glmmADMB or glmmTMB

  • $\begingroup$ Hi Robert, Many thanks for your helpful response. I am currently trying to use the glmmTMB but not sure what to insert for ziformula. And unfortunately, I get an error. Do you know what could be wrong here? fit_zibinomial <- glmmTMB(Mentions ~ IFS*IFR + (1|HOsenders) + (1|HOreceivers), data=df, ziformula=~1, family=binomial) $\endgroup$
    – Lea
    Jun 2, 2021 at 13:36
  • $\begingroup$ This is the error: Error in eval(family$initialize) : y values must be 0 <= y <= 1 $\endgroup$
    – Lea
    Jun 2, 2021 at 13:40
  • $\begingroup$ You're welcome. Unfortunately, without more details it's very hard to diagnose. family=binomial may be the reason, as this may be telling glmmTMB that it's a logistic regression (hence the error about being bounded by 0 and 1. You prbably need poisson or negative binomial. You could ask a new question if you are still struggling, but in that case try to make it about statistics, not programming, or it make be closed as off topic. $\endgroup$ Jun 2, 2021 at 13:45
  • $\begingroup$ Thank you for your help and advice, Robert! I find them really helpful. And apologies for these technical questions. I will make sure to focus future questions on statistics. $\endgroup$
    – Lea
    Jun 2, 2021 at 13:56
  • $\begingroup$ Apologies, as a newbie on StackExchange I was not aware of the possibility to accept an answer. Back then, I therefore only upvoted it to mark it as useful. Now it is upvoted and accepted. Thank you for the hint and your support. $\endgroup$
    – Lea
    Jun 28, 2021 at 7:37

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.