Tutorials › Generalized Linear Mixed Models (GLMM) › Matching NB1 And NB2 To Count Variance Patterns

Responses: Binary, Count, Ordinal, Overdispersed · Tutorial 106 of 698

Matching NB1 And NB2 To Count Variance Patterns

Learn how NB1’s linear and NB2’s quadratic excess variance patterns guide count-model choice, and how to check that choice against fitted models and diagnostics.

Intermediate 11 min read

What You'll Learn

  • State the NB1 and NB2 variance functions and their dispersion parameters.
  • Derive both patterns from Poisson-Gamma mixing.
  • Compare variance estimates across fitted means without confusing mean variation with dispersion.
  • Use exposure and grouped-count summaries to assess which pattern is more plausible.
  • Compare fitted NB1 and NB2 models with AIC and inspect key limitations.

Why distinguish two negative binomial patterns?

A count response can vary more than a Poisson model permits, but “extra variation” does not specify how that variation grows with the mean. NB1 and NB2 are two negative binomial parameterizations that make different predictions as the expected count changes. The distinction matters when observations have substantially different fitted means: the models can agree at low means yet imply quite different variability at high means.

The earlier material on the negative binomial as a Poisson overdispersion family establishes why a negative binomial model can allow variance beyond the Poisson value. Here the focus is narrower: use the shape of the variance-mean relationship to assess whether NB1 or NB2 is a better representation. Neither parameterization should be selected from a single variance estimate or treated as a universal description of count data.

Definition: Let \(Y\) be a count with conditional mean \(\mu>0\). Under NB1, \(\operatorname{Var}(Y\mid\cdot)=\mu+\alpha_1\mu=\mu(1+\alpha_1)\), where \(\alpha_1\geq 0\). Under NB2, \(\operatorname{Var}(Y\mid\cdot)=\mu+\alpha_2\mu^2\), where \(\alpha_2\geq 0\). The conditioning is on the predictors and, in a mixed model, the random effects. When the dispersion parameter is zero, either variance reduces to the Poisson variance \(\mu\).

The extra variance above Poisson is \(\alpha_1\mu\) for NB1 and \(\alpha_2\mu^2\) for NB2. Thus NB1 has a constant variance-to-mean ratio, \(1+\alpha_1\), while NB2 has a constant excess-variance-to-squared-mean ratio, \((\operatorname{Var}(Y\mid\cdot)-\mu)/\mu^2=\alpha_2\). Equivalently, the NB2 variance-to-mean ratio is \(1+\alpha_2\mu\), which increases with the mean. These are different patterns, not simply two names for the same fitted dispersion.

Distributional assumptions and a justification

Both models assign probability to nonnegative integer counts. One common negative binomial parameterization uses a mean \(\mu\) and a positive size parameter \(r\), with probability mass function

$$ P(Y=y)=\frac{\Gamma(y+r)}{\Gamma(r)y!} \left(\frac{r}{r+\mu}\right)^r \left(\frac{\mu}{r+\mu}\right)^y,\qquad y=0,1,2,\ldots. $$

For NB2, \(r=1/\alpha_2\) is constant across observations when \(\alpha_2>0\). For NB1, \(r=\mu/\alpha_1\), so the size changes with the mean. This parameterization makes both variance formulas transparent. It also identifies an assumption that can be overlooked: each model imposes a particular relationship between the mean and dispersion, rather than giving every observation an unrelated variance.

A short derivation comes from a Poisson-Gamma mixture. Suppose, conditional on a latent rate \(\Lambda\), that \(Y\) is Poisson with mean \(\Lambda\). Let \(\Lambda\) have a Gamma distribution with shape \(r\) and rate \(r/\mu\), so \(E(\Lambda)=\mu\) and \(\operatorname{Var}(\Lambda)=\mu^2/r\). The law of total variance gives

$$ \operatorname{Var}(Y) =E\{\operatorname{Var}(Y\mid\Lambda)\} +\operatorname{Var}\{E(Y\mid\Lambda)\} =E(\Lambda)+\operatorname{Var}(\Lambda) =\mu+\frac{\mu^2}{r}. $$

Setting \(r=1/\alpha_2\) yields the NB2 variance, \(\mu+\alpha_2\mu^2\). Setting \(r=\mu/\alpha_1\) yields the NB1 variance, \(\mu+\alpha_1\mu\). The derivation shows why the patterns differ: NB2 uses a constant Gamma shape, whereas NB1’s shape varies with the mean. The mixture is a useful justification for the variance forms; it does not establish that a particular data-generating process is truly a Poisson-Gamma mixture.

For these formulas to guide selection, the mean model must be reasonably specified, the response must be a count, and observations must be independent at the level being modeled—or their dependence must be represented by the model. In a GLMM, the formulas describe variance conditional on the predictors and random effects. Do not compare them directly with marginal variances that also include variation across random effects. The dispersion parameter is assumed constant on its stated scale unless the model explicitly allows it to vary.

Reading variance patterns across means

A practical comparison asks how the excess variance changes as the fitted mean changes. If replicate observations are available at similar fitted means, estimate a variance within those groups and compare it with the mean. A pattern in which \((s^2-\mu)/\mu\) is roughly stable is compatible with NB1; a pattern in which \((s^2-\mu)/\mu^2\) is roughly stable is compatible with NB2. Here \(s^2\) is a within-group sample variance, used as a noisy estimate of the relevant conditional variance.

The comparison is meaningful only when mean differences have been handled. A raw variance computed across observations with different expected counts includes variation due to their different means; it is not a direct estimate of the conditional variance at one mean. In practice, fitted means or carefully chosen groups with similar covariate profiles can help organize diagnostics. When there is only one count at each distinct mean, there is no direct within-mean sample variance; model-based residual diagnostics and likelihood comparisons become more important.

Worked Example: A Linear Excess-Variance Pattern

Suppose a hypothetical data set has groups of replicate counts with fitted means near 1, 3, and 5. Their estimated within-group variances are 1.5, 4.5, and 7.5. Which variance pattern do these summaries suggest?

For each group, subtract the Poisson variance, which equals the mean. The excess variances are \(1.5-1=0.5\), \(4.5-3=1.5\), and \(7.5-5=2.5\). Divide each by the mean:

$$ \frac{0.5}{1}=0.5,\qquad \frac{1.5}{3}=0.5,\qquad \frac{2.5}{5}=0.5. $$

The excess variance per unit of mean is constant at 0.5, suggesting NB1 with \(\alpha_1\approx0.5\). Its predicted variances are \(1(1+0.5)=1.5\), \(3(1+0.5)=4.5\), and \(5(1+0.5)=7.5\), matching the summaries. For NB2, the corresponding excess-to-squared-mean ratios are \(0.5/1=0.5\), \(1.5/9\approx0.167\), and \(2.5/25=0.100\), which are not approximately constant. These summaries favor the NB1 pattern, but sampling variability means they do not prove that NB1 is the data-generating model.

Worked Example: A Quadratic Excess-Variance Pattern

Consider another hypothetical set of replicate-count summaries: fitted means of 1, 3, and 5, with estimated variances of 1.2, 4.8, and 10.0. Assess the two variance patterns.

The excess variances above Poisson are \(1.2-1=0.2\), \(4.8-3=1.8\), and \(10.0-5=5.0\). Dividing these by squared means gives

$$ \frac{0.2}{1^2}=0.200,\qquad \frac{1.8}{3^2}=0.200,\qquad \frac{5.0}{5^2}=0.200. $$

The ratios are constant, consistent with NB2 and \(\alpha_2\approx0.2\). Its predicted variances are \(1+0.2(1^2)=1.2\), \(3+0.2(3^2)=4.8\), and \(5+0.2(5^2)=10.0\). By contrast, the NB1 excess-to-mean ratios are 0.2, 0.6, and 1.0, increasing with the mean rather than remaining roughly constant. The pattern suggests NB2. As in the first example, the estimates are hypothetical and actual sample variances can depart from their expected pattern.

Exposure, model comparison, and diagnostics

Exposure can help distinguish the patterns, but it does not settle the choice by itself. Suppose a rate is approximately constant and the expected count is \(\mu=e\lambda\), where \(e\) is exposure and \(\lambda\) is the rate per exposure unit. Under NB1, \(\operatorname{Var}(Y)/\mu=1+\alpha_1\) is constant as exposure changes. Under NB2, \(\operatorname{Var}(Y)/\mu=1+\alpha_2 e\lambda\) increases with exposure. This comparison assumes the rate and dispersion structure are otherwise appropriate; changes in exposure can also coincide with changes in the underlying population or mean model.

Worked Example: Using Exposure to Compare Variance Patterns

In a hypothetical setting, the modeled rate is \(\lambda=2\) counts per exposure unit. Compare NB1 with \(\alpha_1=0.3\) and NB2 with \(\alpha_2=0.1\) at exposures \(e=1,2,4\). The corresponding means are \(\mu=2,4,8\).

For NB1, the predicted variances are \(\mu(1+0.3)\): \(2(1.3)=2.6\), \(4(1.3)=5.2\), and \(8(1.3)=10.4\). The variance-to-mean ratio is 1.3 at each exposure.

For NB2, the predicted variances are \(\mu+0.1\mu^2\): \(2+0.1(4)=2.4\), \(4+0.1(16)=5.6\), and \(8+0.1(64)=14.4\). Its variance-to-mean ratios are \(2.4/2=1.2\), \(5.6/4=1.4\), and \(14.4/8=1.8\). Thus NB2 predicts a progressively larger variance relative to the mean at higher exposure. If replicate data showed that progression after a suitable mean model was fitted, it would support NB2 over NB1. It would not, on its own, establish why the extra variation occurs.

Variance summaries are useful diagnostics, not a substitute for fitting the full response model. Compare NB1 and NB2 with the same observations and mean-model structure, and check that both fits converged and yield sensible fitted values. AIC compares fitted likelihood models while penalizing the number of estimated parameters; for a model with \(k\) estimated parameters and maximized log likelihood \(\ell\), \(\mathrm{AIC}=-2\ell+2k\). AIC is useful for comparing these non-nested alternatives when their likelihoods are computed for the same response data under comparable likelihood definitions. It does not identify a true model or explain the source of overdispersion.

Worked Example: Correctly Interpreting an AIC Difference

Suppose hypothetical NB1 and NB2 models use the same data and mean structure, each estimate \(k=4\) parameters, and have maximized log likelihoods \(-90\) and \(-86\), respectively. Calculate and compare their AIC values.

For NB1, \(\mathrm{AIC}_1=-2(-90)+2(4)=180+8=188\). For NB2, \(\mathrm{AIC}_2=-2(-86)+2(4)=172+8=180\). Therefore \(\mathrm{AIC}_2-\mathrm{AIC}_1=180-188=-8\). Equivalently, with equal parameter counts, the difference is \(-2[-86-(-90)]=-2(4)=-8\). NB2 has an AIC eight points lower than NB1 in this comparison, so the fitted likelihood-and-complexity trade-off favors NB2. This is relative evidence among the models compared, not a probability that NB2 is true.

A useful diagnostic sequence is to inspect whether the fitted mean structure is credible, examine variability across ranges of fitted means, and then check model-based residual patterns and likelihood-based comparisons. Patterns that change systematically with fitted means can indicate that the chosen variance function is inadequate. Extreme counts or an excess of zeros can also produce poor fit, but neither feature automatically establishes NB1 or NB2; investigate the fitted distribution and the response process rather than selecting a parameterization from a label such as “overdispersed.”

Common pitfalls and limits

  • Using the overall sample variance. Counts with different expected means can have a large pooled variance even if the conditional variance function is correct. Compare variability at similar fitted means or use conditional model diagnostics.
  • Choosing from one mean level. At a single \(\mu\), both models can match the same variance by choosing different dispersion parameters. The distinction is the pattern across a range of means.
  • Treating noisy ratios as decisive. Ratios such as \((s^2-\mu)/\mu^2\) can be unstable, especially with few replicates or small means. Use them as descriptive evidence and check uncertainty and fitted-model behavior.
  • Ignoring dependence or mean-model errors. Unmodeled clustering, omitted predictors, or a poor exposure specification can look like extra dispersion. A dispersion choice cannot repair those problems automatically.
  • Reading a preferred variance function as a mechanism. A better NB1 or NB2 fit describes the observed conditional variance pattern; it does not prove a particular biological or sampling mechanism.

The main alternative is the other negative binomial parameterization; the Poisson model is also a useful reference when the variance is close to the mean. NB1 and NB2 are limited to their respective variance shapes and may both fit poorly. They are not remedies for every kind of distributional misspecification, and AIC can only rank the candidate models actually considered. The practical conclusion should therefore combine a plausible mean model, variance-pattern diagnostics, and comparable model fits.

Key takeaway: NB1 keeps excess variance proportional to the mean; NB2 keeps excess variance proportional to the squared mean. Assess that distinction across fitted means, conditional on the model structure, and treat variance summaries and AIC as evidence rather than proof.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. At means 2 and 6, a set of hypothetical variance estimates has excesses above the mean of 0.8 and 2.4. Which parameterization do these summaries favor?
  2. For NB2 with \(\alpha_2=0.15\), what is the predicted variance when \(\mu=4\)?
  3. Why is the variance of all counts pooled across widely different fitted means not a direct diagnostic of the conditional variance function?
  4. Two models have the same parameter count and log likelihoods \(-52\) for NB1 and \(-50\) for NB2. Which has lower AIC, and by how much?

Solutions. (1) The excess-to-mean ratios are \(0.8/2=0.4\) and \(2.4/6=0.4\), so the summaries favor NB1, though they do not establish it. (2) \(\operatorname{Var}(Y\mid\cdot)=4+0.15(4^2)=4+2.4=6.4\) count-squared units. (3) The pooled variance includes differences in expected counts as well as conditional variation; within-mean or model-based diagnostics are needed to assess the conditional variance. (4) With equal parameter counts, \(\mathrm{AIC}_2-\mathrm{AIC}_1=-2[-50-(-52)]=-2(2)=-4\). NB2 has AIC lower by 4 points.

Clinical Biostats