Tutorials › Generalized Linear Mixed Models (GLMM) › Observation-Level Random Effects Versus Negative Binomial Models

Overdispersion and Zero Inflation · Tutorial 537 of 698

Observation-Level Random Effects Versus Negative Binomial Models

Learn how lognormal and gamma mixing can produce the same count mean and variance but different tail probabilities, and how to choose a model that matches the data structure.

Advanced 12 min read

What You'll Learn

  • Write the Poisson-lognormal model for an observation-level random effect and derive its marginal mean and variance.
  • Match its variance to the negative-binomial Type 2 variance using a precise dispersion conversion.
  • Compare the models through higher factorial moments and zero-count probabilities.
  • Distinguish observation-specific overdispersion from dependence induced by shared group effects.
  • Identify diagnostics, assumptions, and limitations relevant to choosing between the models.

Two Ways to Represent Extra-Poisson Variation

A Poisson model assumes that, conditional on its rate, a count has variance equal to its mean. In count data, variation can exceed that level even after measured predictors and group-level random effects have been included. Two common representations are an observation-level random effect, which gives each count its own latent multiplicative effect, and a negative-binomial Type 2 model, whose rate is mixed by a gamma distribution. The central comparison is subtle: the models can have exactly the same marginal mean and variance, yet assign different probabilities to individual count values.

The observation-level effect is not a shared cluster effect. Its latent value applies to one observation only, so it can inflate that observation's variance without, by itself, creating covariance between two observations in the same cluster. The negative-binomial distribution likewise describes extra variation in a count; it does not automatically create dependence among multiple counts. Shared random effects are needed to represent dependence arising from common groups.

Definition: Let \(Y_i\) be a count and let \(m_i\) be its marginal mean. An observation-level lognormal random effect can be written as \(Y_i\mid W_i\sim\operatorname{Poisson}(m_iW_i)\), where \(W_i=\exp(u_i-\sigma^2/2)\), \(u_i\sim N(0,\sigma^2)\), and the \(u_i\) are independent across observations. Thus \(E(W_i)=1\). A negative-binomial Type 2 (NB2) count with mean \(m_i\) and dispersion \(\alpha\geq0\) has variance \(m_i+\alpha m_i^2\); at \(\alpha=0\), it reduces to Poisson.

In the usual log-link GLMM parameterization, the conditional rate is often written \(\lambda_i\exp(u_i)\), where \(\lambda_i=\exp(x_i^\mathsf{T}\beta+\text{offset}_i)\) is the rate at \(u_i=0\). Here \(\lambda_i\) is not the marginal mean: integrating over the normal effect gives marginal mean \(\lambda_i\exp(\sigma^2/2)\). Equivalently, use \(m_i=\lambda_i\exp(\sigma^2/2)\) and the mean-one multiplier \(W_i\) above. This distinction matters when comparing coefficients or predicted means across models.

Deriving the Matching Mean and Variance

For a Poisson mixture, the law of total expectation and the law of total variance give \(E(Y_i)=E(\Lambda_i)\) and \(\operatorname{Var}(Y_i)=E(\Lambda_i)+\operatorname{Var}(\Lambda_i)\), where \(\Lambda_i\) is the random Poisson rate. For the mean-one lognormal multiplier, the normal moment-generating function gives \(E(W_i^r)=\exp\{(r^2-r)\sigma^2/2\}\). In particular, \(E(W_i)=1\) and \(\operatorname{Var}(W_i)=\exp(\sigma^2)-1\). Therefore:

$$ \begin{aligned} E(Y_i)&=E\{E(Y_i\mid W_i)\}=E(m_iW_i)=m_i,\\ \operatorname{Var}(Y_i) &=E\{\operatorname{Var}(Y_i\mid W_i)\} +\operatorname{Var}\{E(Y_i\mid W_i)\}\\ &=E(m_iW_i)+\operatorname{Var}(m_iW_i)\\ &=m_i+m_i^2\{\exp(\sigma^2)-1\}. \end{aligned} $$

The NB2 variance is \(m_i+\alpha m_i^2\). Consequently, the models have matching first two moments when \(\alpha=\exp(\sigma^2)-1\), or, in the reverse direction, \(\sigma^2=\log(1+\alpha)\). This is a moment match, not a claim that the two mixture distributions are identical.

Key result: A Poisson-lognormal observation-level effect and an NB2 model with the same marginal mean have the same variance when \(\alpha=\exp(\sigma^2)-1\). That equality alone does not establish that they give the same probabilities, tails, or fitted predictions.

Worked Example: Matching the Marginal Mean and Variance

Suppose a hypothetical count has marginal mean \(m=4\). An observation-level effect has variance \(\sigma^2=\log(2)\), so \(\exp(\sigma^2)=2\). Its implied NB2 dispersion is \(\alpha=2-1=1\). Both models therefore imply \[ \operatorname{Var}(Y)=4+1(4^2)=4+16=20. \]

In the conventional uncentered random-intercept form \(Y\mid u\sim\operatorname{Poisson}(\lambda\exp(u))\), the marginal mean is \(\lambda\exp(\sigma^2/2)\). To make that mean equal to 4, set \(\lambda=4/\exp\{\log(2)/2\}=4/\sqrt{2}=2.828\). The conditional rate at \(u=0\) is therefore 2.828, while the marginal mean is 4. Using 2.828 as though it were the marginal mean would give an incorrect variance comparison.

Same Variance Does Not Mean Same Distribution

A useful way to expose the difference is to examine factorial moments. For a Poisson count conditional on rate \(\Lambda_i\), the \(r\)th factorial moment is \(E\{Y_i(Y_i-1)\cdots(Y_i-r+1)\mid\Lambda_i\}=\Lambda_i^r\). Averaging over the mixing distribution therefore gives \(E\{(Y_i)_r\}=E(\Lambda_i^r)\). For the mean-one lognormal multiplier, this becomes \(m_i^r\exp\{(r^2-r)\sigma^2/2\}\).

For NB2, the equivalent rate mixture is \(\Lambda_i=m_iG_i\), where \(G_i\) has a gamma distribution with shape \(1/\alpha\), scale \(\alpha\), mean 1, and variance \(\alpha\). Its \(r\)th moment is \(\prod_{j=0}^{r-1}(1+j\alpha)\). The second factorial moments agree under the variance-matching conversion. The third generally does not:

$$ \begin{aligned} E\{(Y_i)_3\}_{\text{lognormal}} &=m_i^3\exp(3\sigma^2) =m_i^3(1+\alpha)^3,\\ E\{(Y_i)_3\}_{\text{NB2}} &=m_i^3(1+\alpha)(1+2\alpha). \end{aligned} $$

For positive \(\alpha\), these expressions differ. The lognormal mixing distribution has a different shape from the gamma mixing distribution, so the induced count distributions can differ in their upper tails and at zero even when their means and variances match. The lognormal mixture generally has no simple closed-form probability mass function; its probabilities are obtained by integrating the conditional Poisson probabilities over the normal effect. The NB2 model has a closed-form negative-binomial probability mass function.

Worked Example: Comparing Third Factorial Moments

Continue with \(m=4\), \(\sigma^2=\log(2)\), and \(\alpha=1\). The lognormal-Poisson third factorial moment is \[ E\{Y(Y-1)(Y-2)\}=4^3\exp\{3\log(2)\} =64(8)=512. \] For the NB2 model it is \[ E\{Y(Y-1)(Y-2)\}=4^3(1+1)(1+2) =64(2)(3)=384. \] Thus the two models agree on mean 4 and variance 20 but not on this third-order feature of the distribution. The discrepancy is not a contradiction: the variance match fixes only the first two moments, not every probability or moment.

Worked Example: Zero Probabilities Under the Two Mixtures

For NB2 with \(m=4\) and \(\alpha=1\), the probability of zero is \[ P(Y=0)=(1+\alpha m)^{-1/\alpha} =(1+1(4))^{-1}=0.200. \] For the variance-matched lognormal-Poisson model, the corresponding probability is \[ P(Y=0)=E\{\exp(-mW)\} =E\left[\exp\left\{-4\exp\left(u-\frac{\log(2)}{2}\right)\right\}\right], \quad u\sim N(0,\log(2)). \] This integral has no elementary closed form. Numerical integration gives approximately 0.13, not 0.200. The value is an approximation from integrating over the normal distribution; it is not obtained by substituting the mean rate into a Poisson zero-probability formula. Both models have the same mean and variance, but this example shows that their probabilities of zero need not match.

What the Observation-Level Effect Can—and Cannot—Explain

An observation-level random effect is appropriate when extra-Poisson heterogeneity is plausibly specific to individual observations and a lognormal latent rate is a defensible representation. It may be used alongside group-level random effects: the group effect represents shared variation, while the observation-level effect represents additional count-specific variation. Because each observation has its own independent latent effect, it does not create extra covariance between distinct observations once shared effects are accounted for.

Worked Example: Separating Observation Variation From Group Dependence

Consider two hypothetical counts from the same clinic. Let their mean rates, after accounting for the clinic effect, be \(m_1=3\) and \(m_2=5\). Suppose they also share a mean-one clinic multiplier \(B\) with \(\operatorname{Var}(B)=0.5\), and have independent observation-level multipliers \(W_1,W_2\), each with mean 1. Conditional on these multipliers, let the counts be independent Poisson with rates \(3BW_1\) and \(5BW_2\).

The observation-level effects add variance to each count, but are independent across the two observations. The shared clinic multiplier produces covariance: \[ \operatorname{Cov}(Y_1,Y_2) =\operatorname{Cov}(3BW_1,5BW_2) =15\{\operatorname{E}(B^2)-[\operatorname{E}(B)]^2\} =15(0.5)=7.50. \] Here \(E(B)=1\), so \(E(B^2)=1+0.5=1.5\), and independence of \(W_1,W_2\) with mean 1 leaves the covariance due to \(B\). If the clinic multiplier were omitted, independent observation-level effects alone would give covariance zero. Adding an observation-level effect is therefore not a substitute for a shared group effect when within-clinic dependence is present.

Model Checks, Alternatives, and Limitations

A comparison should begin with the sampling and dependence structure, not just with which model produces a larger variance estimate. State whether counts are conditionally independent given the modeled random effects, identify which effects are shared, and specify the conditional mean and mixing distribution. For the observation-level model, the normal effects are assumed independent across observations and normally distributed on the log-rate scale. For the gamma-mixture interpretation of NB2, the rate multiplier has a gamma distribution with the stated mean and variance. Both retain a Poisson sampling distribution conditional on the latent rate.

Useful checks include comparing observed and model-implied count frequencies, especially zero and large counts, and examining whether residual variation remains across fitted-mean ranges or within groups. Such checks should be interpreted against predictions from the fitted model, preferably using simulation that reproduces its grouping and design. A variance match at each mean cannot diagnose a wrong mixing distribution by itself. Signs of trouble include systematic excesses of zeros or large counts relative to simulated data, residual association among observations in the same group after shared effects are included, or strong sensitivity of conclusions to the chosen mixing assumption.

The principal alternatives answer different modeling needs. An NB2 model uses gamma mixing and a convenient closed-form count distribution; an observation-level random effect uses normal mixing on the log-rate scale and is naturally expressed as a GLMM random effect. A Poisson model is simpler but imposes conditional equidispersion. A model with shared random intercepts or slopes addresses dependence associated with common groups; it may be combined with either overdispersion representation when justified. None is automatically correct because it fits the observed variance. The choice should reflect the scientific and sampling structure, distributional fit, and the purpose of the analysis.

FeatureObservation-level lognormal effectNB2 count model
Latent rate multiplierLognormal, with mean 1 after centeringGamma, with mean 1 and variance \(\alpha\)
Marginal variance\(m_i+m_i^2\{\exp(\sigma^2)-1\}\)\(m_i+\alpha m_i^2\)
Moment-matching conversion\(\alpha=\exp(\sigma^2)-1\)\(\sigma^2=\log(1+\alpha)\)
Distributional implicationLognormal-Poisson mixture; generally evaluated by integrationNegative-binomial probability mass function
Dependence across observationsNone from independent observation-specific effects aloneNone from the count distribution alone; shared effects are separate

A practical limitation of an observation-level effect is that it adds a latent parameter for each observation; it should not be interpreted as a set of reliably estimated individual effects when there is only one count per observation. Its role is to specify a distribution for residual heterogeneity. Conversely, the NB2 dispersion parameter imposes gamma mixing, which may not describe the data's higher moments. A numerical fit or a matched variance cannot remove these assumptions.

Common Pitfall

Wrong reasoning: “The observation-level model and NB2 give the same mean and variance, so they are interchangeable.” Correction: Their mixing distributions differ. The third factorial moments and zero probabilities can differ even under an exact first-two-moment match. Choose and assess a model using the distributional and dependence assumptions relevant to the data, not only its variance formula.

Key takeaway: Observation-level lognormal effects and NB2 dispersion can represent the same quadratic mean-variance relationship through \(\alpha=\exp(\sigma^2)-1\). They remain distinct probability models, and neither one alone represents dependence caused by shared groups.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. If an observation-level effect has \(\sigma^2=\log(1.25)\), what NB2 dispersion matches its mean and variance?
  2. For \(m=2\) and \(\alpha=0.5\), calculate the NB2 marginal variance.
  3. Why can two models with the same mean and variance still give different probabilities of zero?
  4. Two counts from one group have independent observation-level effects but share no group effect. Does the observation-level mixing alone induce covariance between them?

Solutions. (1) \(\alpha=\exp\{\log(1.25)\}-1=0.25\). (2) \(\operatorname{Var}(Y)=2+0.5(2^2)=4\). (3) Mean and variance constrain only the first two moments; the lognormal and gamma mixing distributions have different higher moments and hence can induce different count probabilities. (4) No. Independent observation-specific effects alone do not create covariance between distinct counts; a shared latent effect or another dependence mechanism is needed.

Clinical Biostats