Chapter 29 Generalized Linear Mixef-Effects Model

Example: Consider the experiment designed to evaluate the effectiveness of an anti-fungal chemical on plants. A total of 60 plant leaves were randomly assigned to treatment with 0, 5, 10, 15, 20, or 25 units of the anti-fungal chemical, with 10 plant leaves for each amount of anti-fungal chemical. All leaves were infected with a fungus. Following a two-week period, the leaves were studied under a microscope, and the number of infected cells was counted and recorded for each leaf.

Let iN(0,σ2) denote a random effect for the ith leaf. Suppose log(λi)=β0+β1xi+i and yiλiPoisson(λi). Finally, suppose 1,,n are independent and that y1,,yn are conditionally independent given λ1,,λn.

Lognormal distribution: if log(v)N(μ,σ2), then v is said to have a lognormal distribution. The mean and variance of a lognormal distribution are E(v)=exp(μ+σ2/2), Var(v)=exp(2μ+2σ2)exp(2μ+σ2).

Suppose log(v)N(μ,σ2) and uvPoisson(v). Then E(u)=E(v)=exp(μ+σ2/2), Var(u)=E(Var(uv))+Var(E(uv))=E(v)+Var(v)=exp(μ+σ2/2)+exp(2μ+2σ2)exp(2μ+σ2)=exp(μ+σ2/2)+(exp(σ2)1)exp(2μ+σ2)=E(u)+(exp(σ2)1)[E(u)]2 So that E(yi)=exp(β0+β1xi+σ2/2) and Var(yi)=E(yi)+(exp(σ2)1)[E(yi)]2. Moreover, we have f_i(y) = P(y_i = y) = \int_{0}^{\infty} \frac{\lambda^{y} \exp (-\lambda)}{y !} \frac{1}{\lambda \sqrt{2 \pi \sigma_{\ell}^{2}}} \exp \left\{\frac{-\left(\log (\lambda)-x_{i}^{\prime} \boldsymbol{\beta}\right)^{2}}{2 \sigma_{\ell}^{2}}\right\} d \lambda. There is no close-form expression for f_i(y) so the integral must be approximated by numerical methods. The glmer function in lme4 package uses Laplace approximation to approximate the integral, but glmer also permits the use of the more general integral approximation method known as adaptive Gauss-Hermite quadrature.

library(lme4)
o = glmer(y ~ x + (1|leaf), family = poisson(link = "log")) # nAGQ = 10
summary(o)

we can set nAGQ = xx to choose the number of points per axis for Gaussian-Hermite Approximation. The default is 1 (Laplace Approximation). Larger nAGQ increases the accuracy but reduces the speed.