From a Dispersion Signal to a Diagnosis
For binomial data, a dispersion summary can flag departures from the fitted model, but it does not explain them. A large Pearson statistic might reflect extra-binomial variation; it might also reflect a mean structure that misses an important predictor, dependence among trials, or a data-handling error. A useful diagnostic therefore combines numerical summaries with the arrangement of the residuals.
The calculations below use \(m\) binomial observations. Observation \(i\) contains \(n_i\) trials and \(Y_i=y_i\) successes, with fitted success probability \(\hat p_i\) and fitted mean \(\hat\mu_i=n_i\hat p_i\). Individual Bernoulli observations are the special case \(n_i=1\). We assume the fitted probabilities are strictly between zero and one for the residual formulas; deviance terms at zero observed successes or failures use the convention \(0\log 0=0\).
Both summaries compare observed outcomes with fitted binomial means, but they weight discrepancies differently. Pearson residuals divide the difference by its fitted standard deviation. Deviance measures the log-likelihood loss relative to a model that fits each binomial observation exactly. The two statistics often tell a similar story, but their values need not match, especially for small samples or probabilities near zero or one.
Worked Example: Grouped Data With Uneven Outcomes
Worked Example: Grouped Data With Uneven Outcomes
Suppose four independent groups each contain 10 trials. An intercept-only binomial model is fitted, so every trial has the same fitted success probability. The observed success counts are 2, 8, 5, and 5.
The pooled estimate is \(\hat p=(2+8+5+5)/40=0.5\). Thus each fitted count is \(\hat\mu_i=10(0.5)=5\), and each fitted variance is \(10(0.5)(0.5)=2.5\).
The Pearson contributions for the four groups are \(9/2.5\), \(9/2.5\), \(0/2.5\), and \(0/2.5\). Therefore \(X_P^2=3.6+3.6=7.2\). The fitted model estimates one parameter from four grouped observations, so \(m-r=4-1=3\) and the Pearson dispersion ratio is \(7.2/3=2.4\).
For a group with 2 successes, the deviance contribution is \(2\{2\log(2/5)+8\log(8/5)\}\approx3.855\). The group with 8 successes has the same contribution by symmetry; the two groups with 5 successes contribute zero. Hence \(D\approx7.710\), and \(D/3\approx2.570\).
Both summaries flag an unusual amount of discrepancy relative to the fitted mean. But the two extreme groups have opposite residual signs: one has fewer successes than fitted and one has more. That pattern is not the same as a persistent shift in one direction. It motivates checking whether the groups differ in a way the intercept-only model does not represent, as well as checking whether trials within a group could be dependent.
Why the Deviance Has This Form
For independent binomial observations, the saturated model assigns a separate probability \(y_i/n_i\) to each observation, fitting every observed count exactly. The residual deviance is twice the log-likelihood difference between this saturated model and the fitted model. The binomial coefficient in each likelihood is the same in both models and cancels.
To verify the expression, the part of the log-likelihood depending on the probability for observation \(i\) is \(y_i\log p_i+(n_i-y_i)\log(1-p_i)\). At the saturated fit, \(p_i=y_i/n_i\) when \(0<y_i<n_i\). Subtracting the fitted-model log-likelihood gives \(y_i\log[(y_i/n_i)/\hat p_i]+(n_i-y_i)\log[(1-y_i/n_i)/(1-\hat p_i)]\). Since \((y_i/n_i)/\hat p_i=y_i/(n_i\hat p_i)\) and \((1-y_i/n_i)/(1-\hat p_i)=(n_i-y_i)/(n_i(1-\hat p_i))\), multiplying the difference by 2 and summing gives the stated deviance. At \(y_i=0\) or \(y_i=n_i\), the same formula follows by continuity, using \(0\log 0=0\). \(\square\)
Worked Example: Unequal Trial Counts
Worked Example: Unequal Trial Counts
Consider three independent grouped observations with trial counts \(n=(2,10,20)\) and success counts \(y=(2,2,10)\). Fit a common success probability. The pooled estimate is \(\hat p=14/32=7/16\), so \(1-\hat p=9/16\).
The fitted means are \(7/8,\ 35/8,\ 35/4\), and the fitted variances are \(n_i(7/16)(9/16)\). The Pearson contributions are \((2-7/8)^2/(2\cdot63/256)=18/7\), \((2-35/8)^2/(10\cdot63/256)=722/315\), and \((10-35/4)^2/(20\cdot63/256)=20/63\). Their sum is \(X_P^2=1632/315\approx5.181\). With one estimated parameter and three grouped observations, the residual degrees of freedom are 2; the Pearson ratio is about \(2.590\).
The deviance contributions are, respectively, \(4\log(16/7)\approx3.307\), \(2\{2\log(16/35)+8\log(64/45)\}\approx2.505\), and \(20\log(64/63)\approx0.315\). Thus \(D\approx6.126\), or \(D/2\approx3.063\).
The raw residuals are \(1.125,\ -2.375,\ 1.25\), but these are not directly comparable as measures of surprise: the observations have different numbers of trials. The Pearson residual scales each discrepancy by its fitted standard deviation. This example also illustrates why a larger count of trials does not automatically mean a larger residual contribution: the third observation has 20 trials but contributes only about 0.317 to the Pearson statistic.
Why Pearson and Deviance Often Agree
When observed counts are close to fitted means and the fitted probability is not near a boundary, the deviance contribution is approximately the squared Pearson residual. This explains why the two summaries often provide similar evidence, while leaving room for differences when a discrepancy is large or the fitted probability is extreme.
For a derivation, define \(g(t)=t\log(t/\mu)+(n-t)\log[(n-t)/(n-\mu)]\), so \(d(y,\mu)=2g(y)\). Direct differentiation gives \(g(\mu)=0\), \(g'(\mu)=0\), and \(g''(\mu)=1/\mu+1/(n-\mu)=1/\{np(1-p)\}\). Also \(g'''(t)=-1/t^2+1/(n-t)^2\). If \(t\) between \(y\) and \(\mu\) stays a fixed positive proportion of \(n\) away from both endpoints, then \(|g'''(t)|=O(n^{-2})\). Taylor's theorem with a remainder therefore gives \(2g(y)=g''(\mu)\delta^2+O(|\delta|^3/n^2)\), which is the claimed approximation. \(\square\)
Worked Example: Individual Bernoulli Outcomes
Worked Example: Individual Bernoulli Outcomes
Ten independent individuals each contribute one Bernoulli outcome. There are five successes and five failures, and an intercept-only model is fitted. The estimated probability is \(\hat p=5/10=0.5\). Every fitted mean is \(0.5\), and every fitted variance is \(0.5(0.5)=0.25\).
For each individual, the observed outcome differs from its fitted mean by \(0.5\) in absolute value. Each squared Pearson residual is therefore \(0.5^2/0.25=1\), giving \(X_P^2=10\). With 10 observations and one estimated parameter, the residual degrees of freedom are 9 and the Pearson ratio is \(10/9\approx1.111\).
Each individual contributes \(2\log 2\) to the deviance, whether the outcome is 0 or 1. Thus \(D=20\log 2\approx13.863\), and \(D/9\approx1.540\). The different ratios do not establish a contradiction: deviance and Pearson statistics weight individual discrepancies differently, and a ratio is not an exact finite-sample measure of dispersion.
For individual Bernoulli data, residual magnitudes can be especially uninformative on their own. With \(\hat p=0.5\), every individual has the same absolute Pearson residual, regardless of whether their fitted probability came from a useful predictor model or an inadequate intercept-only model. Plotting signed residuals against fitted probabilities, predictors, or meaningful groupings can reveal structure that the overall statistic conceals.
Worked Example: A Missing Group Predictor
Worked Example: A Missing Group Predictor
Suppose four independent groups each have 10 trials. Two groups belong to category A and have 8 successes apiece; two belong to category B and have 2 successes apiece. First fit an intercept-only model. The pooled success proportion is \(20/40=0.5\), so all fitted counts are 5.
As in the first example, each group contributes \(3.6\) to \(X_P^2\), giving \(X_P^2=14.4\). Each contributes approximately \(3.855\) to the deviance, giving \(D\approx15.420\). The residuals have a clear pattern: both A groups are above their fitted means, and both B groups are below.
Now add the category indicator to the mean model. The fitted probabilities become \(16/20=0.8\) for A and \(4/20=0.2\) for B. Each group’s observed count then equals its fitted count, so both \(X_P^2\) and \(D\) are zero for these data. Here the intercept-only dispersion signal was caused by a missing predictor pattern, not evidence by itself of extra-binomial variation.
This exact fit is a feature of these particular counts, not a general promise that adding a predictor will eliminate overdispersion. The relevant diagnostic is whether residuals show a systematic relationship with a predictor or grouping that is scientifically and statistically appropriate to include.
Reading Residual Patterns and Checking Assumptions
A dispersion statistic compresses all residuals into one number. Keep the signed residuals visible when diagnosing a signal. Residuals plotted against fitted means can show changes in spread or systematic curvature; residuals against predictors can reveal an omitted trend or group effect; residuals indexed by time, subject, site, or cluster can reveal runs or clustering. A pattern is a prompt to investigate the mean structure or dependence assumptions, not a proof of a particular cause.
For grouped binomial data, check that each \(n_i\) is the actual number of trials represented by observation \(i\), and that the success count does not exceed it. Unequal trial counts are not inherently a problem: the fitted variance \(n_i\hat p_i(1-\hat p_i)\) accounts for them. But treating proportions as if they had equal precision, or entering an incorrect denominator, can distort residuals and summaries.
The binomial variance also relies on the trials represented by a count being conditionally independent with a common success probability for that observation. If outcomes cluster within patients, households, sites, or time periods, the residuals may be related even after conditioning on fitted predictors. Look for repeated same-direction residuals within such units and consider whether the sampling structure was represented correctly. A plot cannot establish independence; the study design and data collection process matter.
Finally, neither \(X_P^2/(m-r)\) nor \(D/(m-r)\) is a stand-alone diagnosis. Their null behavior depends on the fitted model and the data configuration, particularly with sparse outcomes or boundary fits. Interpret them alongside residual plots, trial-count checks, the plausibility of the mean model, and the independence assumptions. When the usual reference approximation is doubtful, calibration under an appropriate null model can help assess how unusual the observed summaries are.
Check Your Understanding
For each question, distinguish a numerical signal from the explanation it might suggest.
- In a grouped binomial model, why should raw count residuals from groups with different trial counts not be compared without scaling?
- What does the deviance compare, and why do the binomial coefficients cancel in that comparison?
- A residual plot shows positive residuals for one site and negative residuals for another. Give one possible mean-model explanation and one possible dependence-related explanation.
- Why can individual Bernoulli Pearson residuals be uninformative about extra-binomial variation when their fitted probabilities are all near one half?
- What does it mean if the Pearson and deviance ratios differ noticeably, and why is that not by itself proof that one calculation is wrong?