# Chapter 16 Negative binomial GLMM

One option for a distribution where the variance increases more rapidly with the mean is the negative binomial (or Poisson-gamma) distribution. Recall that the negative binomial distribution meets the assumption that the variance is proportional to the square of the mean.

We can model this distribution using the function glmer.nb():

# Negative binomial GLMM using the function glmer.nb()
mnb1 <- glmer.nb(total.fruits ~ nutrient * amd + rack + status +
(1 | popu) + (1 | gen), data = dat.tf, control = glmerControl(optimizer = "bobyqa"))
# Control argument specifies the way we optimize the
# parameter values

We test again for over-dispersion:

# Over-dispersion check
overdisp_fun(mnb1)
##         chisq         ratio             p          logp
## 721.034466390   1.170510497   0.002143424  -6.145350714
# Ratio is now much closer to 1 although p < 0.05

Ratio is now much closer to 1 although p < 0.05