# Chapter 9 Nonlinear and Generalized Linear Mixed Models

• NLMMs extend the nonlinear model to include both fixed effects and random effects
• GLMMs extend the generalized linear model to include both fixed effects and random effects.

A nonlinear mixed model has the form of

$Y_{ij} = f(\mathbf{x_{ij} , \theta, \alpha_i}) + \epsilon_{ij}$

for the j-th response from cluster (or sujbect) i ($$i = 1,...,n$$), where

• $$j = 1,...,n_i$$
• $$\mathbf{\theta}$$ are the fixed effects
• $$\mathbf{\alpha}_i$$ are the random effects for cluster i
• $$\mathbf{x}_{ij}$$ are the regressors or design variables
• $$f(.)$$ is nonlinear mean response function

A GLMM can be written as:

we assume

$y_i |\alpha_i \sim \text{indep } f(y_i | \alpha)$

and $$f(y_i | \mathbf{\alpha})$$ is an exponential family distribution,

$f(y_i | \alpha) = \exp [\frac{y_i \theta_i - b(\theta_i)}{a(\phi)} - c(y_i, \phi)]$

The conditional mean of $$y_i$$ is related to $$\theta_i$$

$\mu_i = \frac{\partial b(\theta_i)}{\partial \theta_i}$

The transformation of this mean will give us the desired linear model to model both the fixed and random effects.

$E(y_i |\alpha) = \mu_i \\ g(\mu_i) = \mathbf{x_i' \beta + z'_i \alpha}$

where $$g()$$ is a known link function and $$\mu_i$$ is the conditional mean. We can see similarity to GLM

We also have to specify the random effects distribution

$\alpha \sim f(\alpha)$

which is similar to the specification for mixed models.

Moreover, law of large number applies to fixed effects so that you know it is a normal distribution. But here, you can specify $$\alpha$$ subjectively.

Hence, we can show NLMM is a special case of the GLMM

$\mathbf{Y}_i = \mathbf{f}(\mathbf{x}_i, \mathbf{\theta, \alpha}_i) + \mathbf{\epsilon}_i \\ \mathbf{Y}_i = \mathbf{g}^{-1} (\mathbf{x}_i' \beta + \mathbf{z}_i' \mathbf{\alpha}_i) + \mathbf{\epsilon}_i$

where the inverse link function corresponds to a nonlinear transformation of the fixed and random effects.

Note:

• we can’t derive the analytical formulation of the marginal distribution because nonlinear combination of normal variables is not normally distributed, even in the case of additive error ($$e_i$$) and random effects ($$\alpha_i$$) are both normal.

Consequences of having random effects

The marginal mean of $$y_i$$ is

$E(y_i) = E_\alpha(E(y_i | \alpha)) = E_\alpha (\mu_i) = E(g^{-1}(\mathbf{x_i' \beta + z_i' \alpha}))$

Because $$g^{-1}()$$ is nonlinear, this is the most simplified version we can go for.

In special cases such as log link ($$g(\mu) = \log \mu$$ or $$g^{-1}() = \exp()$$) then

$E(y_i) = E(\exp(\mathbf{x_i' \beta + z_i' \alpha})) = \exp(\mathbf{x'_i \beta})E(\exp(\mathbf{z}_i'\alpha))$

which is the moment generating function of $$\alpha$$ evaluated at $$\mathbf{z}_i$$

Marginal variance of $$y_i$$

\begin{aligned} var(y_i) &= var_\alpha (E(y_i | \alpha)) + E_\alpha (var(y_i | \alpha)) \\ &= var(\mu_i) + E(a(\phi) V(\mu_i)) \\ &= var(g^{-1} (\mathbf{x'_i \beta + z'_i \alpha})) + E(a(\phi)V(g^{-1} (\mathbf{x'_i \beta + z'_i \alpha}))) \end{aligned}

Without specific assumption about $$g()$$ and/or the conditional distribution of $$\mathbf{y}$$, this is the most simplified version.

Marginal covariance of $$\mathbf{y}$$

In a linear mixed model, random effects introduce a dependence among observations which share any random effect in common

\begin{aligned} cov(y_i, y_j) &= cov_{\alpha}(E(y_i | \mathbf{\alpha}),E(y_j | \mathbf{\alpha})) + E_{\alpha}(cov(y_i, y_j | \mathbf{\alpha})) \\ &= cov(\mu_i, \mu_j) + E(0) \\ &= cov(g^{-1}(\mathbf{x}_i' \beta + \mathbf{z}_i' \mathbf{\alpha}), g^{-1}(\mathbf{x}'_j \beta + \mathbf{z}_j' \mathbf{\alpha})) \end{aligned}

• Important: conditioning to induce the covariability

Example:

Repeated measurements on the subjects. Let $$y_{ij}$$ be the j-th count taken on the i-th subject.

then, the model is $$y_{ij} | \mathbf{\alpha} \sim \text{indep } Pois(\mu_{ij})$$. Here

$\log(\mu_{ij}) = \mathbf{x}_{ij}' \beta + \alpha_i$

where $$\alpha_i \sim iid N(0,\sigma^2_{\alpha})$$

which is a log-link with a random patient effect.