I have a dataset where the response variable fits a negative binomial distribution much better than the normal distribution (see image below). The variable is discrete but not binary. I am hoping to model this variable with several explanatory variables, including a continuous variable, a categorical variable, and a single mixed effect. Is it appropriate to use the binomial family with glmer for this response variable even though it isn't a binary variable, and if so which link function should I use?

Thanks for your help.

enter image description here

enter image description here


1 Answer 1


The negative binomial distribution has support on the set of non-negative integers; there's nothing that requires data to be binary and indeed, the NegBin is commonly used as a model for discrete count data where there is extra variance than that assumed by the Poisson distribution.

You ask: "Is it appropriate to use the binomial family with glmer for this response variable?" Are you interested in the negative binomial or the binomial? If it is the former, then yes, do model using the glmer.nb() function in lme4.

If you have an integer valued response then I have seen that modelled using a binomial distribution but not with the default link function - the log link is used for example. I'm not really sure exactly what kind of model this is fitting, but has been used in ecology for modelling presence-only data IIRC.

Note that when modelling the response, we assume that the observations are conditionally distributed negative binomial (in the case of glmer.nb()), where by conditionally we mean that each observation is drawn from the specified distribution with mean equal to a linear predictor (on the scale of the link function). This means that the raw response data do not need to look like they are distributed negative binomial if you try to fit such a distribution to them.

  • $\begingroup$ Yes, I was specifically asking about the "negative binomial", but thank you for explaining both in your response. After investigating glmer.nb() (which I wasn't familiar with) I learned that my second question about which link function to use is not relevant when using glmer.nb(), so great all around. Thanks so much for taking the time to give such a thorough answer to my question! $\endgroup$
    – Jay
    Apr 23, 2018 at 20:18

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.