Chapter 15 Poisson GLMM
Given the mean-variance relationship, we will most likely need a model with over-dispersion.
To understand why, let’s start with a Poisson model.
To run a GLMM in R
we will use the glmer()
function from the lme4
package:
# Poisson GLMM Given the mean-variance relationship, we
# will most likely need a model with over-dispersion. To
# understand why, let's start with a Poisson model.
<- glmer(total.fruits ~ nutrient * amd + rack + status +
mp1 1 | popu) + (1 | gen), data = dat.tf, family = "poisson") (
Random effects: (1|popu)
and (1|gen)
. We model random intercepts for both factors so that total fruit production can vary among populations (popu
) and genotypes (gen
).
Over-dispersion check
We can check for overdispersion using the overdisp_fun()
function (Bolker et al. 2011) which divides the Pearson residuals by the residual degrees of freedom.
The function tests whether the ratio is greater than 1.
Let’s run the test:
# Download the glmm_funs.R code from the wiki page and
# source it to run the function
source(file = "data/glmm_funs.R") # This line will vary depending on where your data is saved
# Over-dispersion check
overdisp_fun(mp1)
## chisq ratio p logp
## 15755.86835 25.57771 0.00000 -6578.47028
# Ratio is significantly > 1
Ratio is significantly > 1
As expected, we need to model a different distribution where the variance increases more rapidly than the mean.