Tutorials › Generalized Linear Models › Comparing Pearson and Deviance Evidence

Detecting Overdispersion · Tutorial 671 of 981

Comparing Pearson and Deviance Evidence

Learn to compare Pearson and deviance evidence for overdispersion by examining their per-observation contributions, not just their overall ratios.

Intermediate 11 min read

What You'll Learn

  • Define Pearson and deviance contributions for grouped binomial and Poisson responses
  • Calculate and compare the two dispersion ratios using residual degrees of freedom
  • Explain why contributions can differ in size and direction
  • Use local expansions to understand when the measures are similar
  • Identify which observations account for disagreement between the totals

Why Compare Two Dispersion Diagnostics?

For a fitted binomial or Poisson generalized linear model, the Pearson statistic and residual deviance are both used to assess whether the data vary more than the fitted mean–variance model would suggest. Each statistic summarizes departures between observed responses and fitted means, but they measure those departures on different scales. Consequently, their dispersion ratios need not agree, and neither ratio alone identifies which observations are responsible.

The useful comparison is therefore two-part: compare the overall ratios, then examine the per-observation contributions that add up to each statistic. This separates a general pattern of extra variation from a discrepancy driven by a few observations, such as a very low count or a response near a binomial boundary.

Definitions and Comparison

Definition: For independent Poisson responses \(Y_i\) with fitted means \(\hat{\mu}_i>0\), the Pearson contribution and deviance contribution for observation \(i\) are \[ \frac{(y_i-\hat{\mu}_i)^2}{\hat{\mu}_i} \quad\text{and}\quad 2\left[y_i\log\left(\frac{y_i}{\hat{\mu}_i}\right)-(y_i-\hat{\mu}_i)\right], \] respectively. The Pearson statistic \(X_P^2\) and residual deviance \(D\) are the sums of their respective contributions. When \(y_i=0\), set \(y_i\log(y_i/\hat{\mu}_i)=0\).

For independent grouped binomial responses \(Y_i\sim\operatorname{Binomial}(m_i,p_i)\), write \(\hat{\mu}_i=m_i\hat p_i\), where \(0<\hat p_i<1\). The corresponding contributions are

$$ \text{Pearson: }\frac{(y_i-m_i\hat p_i)^2}{m_i\hat p_i(1-\hat p_i)},\qquad \text{deviance: }2\left[ y_i\log\left(\frac{y_i}{m_i\hat p_i}\right) +(m_i-y_i)\log\left(\frac{m_i-y_i}{m_i(1-\hat p_i)}\right) \right]. $$

A term of the form \(0\log 0\) is defined to be zero. The binomial formula includes individual Bernoulli observations as the special case \(m_i=1\). These definitions use the fitted mean structure; they do not presume that a dispersion parameter has already been estimated.

If there are \(n\) response units and the fitted mean model has rank \(r\), the commonly reported dispersion ratios are \(X_P^2/\nu\) and \(D/\nu\), with residual degrees of freedom \(\nu=n-r\). Their interpretation as diagnostics is approximate: fitted parameters affect the residual statistics, and the ratios are not exact measures of a population dispersion parameter. Since both use the same \(\nu\), their difference is determined by the difference between the two totals.

Worked Comparisons

Worked Example: A Poisson Fit With One Low and One High Count

Suppose three independent Poisson counts are fitted with an intercept-only model. The maximum-likelihood fitted mean is the sample average. For observed counts \(0,4,8\), it is \(\hat{\mu}=(0+4+8)/3=4\) for each observation. The model has one fitted parameter, so \(\nu=3-1=2\).

The Pearson contributions are \((0-4)^2/4=4\), \((4-4)^2/4=0\), and \((8-4)^2/4=4\). Thus \(X_P^2=4+0+4=8\), and the Pearson ratio is \(8/2=4\).

The deviance contributions are \(2[0-(0-4)]=8\) for the zero count, \(0\) for the count equal to its fitted mean, and \(2[8\log(8/4)-(8-4)]=2[8\log 2-4]\approx3.09035\) for the count of 8. Hence \(D\approx8+0+3.09035=11.09035\), and the deviance ratio is approximately \(11.09035/2=5.54518\).

The Pearson contribution for the high count is \(4\), while its deviance contribution is about \(3.09035\). The low count goes the other way: its deviance contribution is \(8\), compared with a Pearson contribution of \(4\). Those opposing local differences explain why the total deviance exceeds the total Pearson statistic by about \(3.09035\), rather than by the difference for the high count alone.

Worked Example: Grouped Binomial Contributions Can Differ in the Opposite Direction

Consider three independent binomial groups, each with \(m_i=10\), and observed successes \(y=(0,2,4)\). Fit an intercept-only binomial model. The maximum-likelihood estimate is \(\hat p=(0+2+4)/(10+10+10)=0.2\), so each fitted mean is \(10(0.2)=2\). There is one fitted parameter and \(\nu=3-1=2\).

The Pearson contributions are \((0-2)^2/[10(0.2)(0.8)]=2.5\), \(0\), and \((4-2)^2/[10(0.2)(0.8)]=2.5\). Thus \(X_P^2=5\), giving a Pearson ratio of \(5/2=2.5\).

For \(y=0\), the deviance contribution is \(2[10\log(10/8)]=20\log(1.25)\approx4.46287\). For \(y=2\), it is zero. For \(y=4\), it is \(2[4\log(4/2)+6\log(6/8)]=2[4\log 2+6\log(0.75)]\approx2.09299\).

Therefore \(D\approx4.46287+0+2.09299=6.55586\), and \(D/\nu\approx3.27793\). The deviance contribution exceeds the Pearson contribution for the zero-success group, while it is smaller for the group with four successes. Inspecting the contributions reveals this balance; the totals alone do not.

Worked Example: Locating the Difference in a Poisson Rate Model

Suppose counts \(y=(0,4,2)\) are observed over exposures \(e=(1,2,3)\), under the Poisson rate model \(Y_i\sim\operatorname{Poisson}(e_i\lambda)\). The maximum-likelihood estimate is \(\hat\lambda=\sum_i y_i/\sum_i e_i=6/6=1\), so the fitted means are \((1,2,3)\). With one fitted parameter, \(\nu=2\).

The Pearson contributions are \((0-1)^2/1=1\), \((4-2)^2/2=2\), and \((2-3)^2/3=1/3\). Thus \(X_P^2=10/3\approx3.33333\), and \(X_P^2/\nu\approx1.66667\).

The deviance contributions are \(2\) for \(y=0\), \(2[4\log(4/2)-(4-2)]=2[4\log 2-2]\approx1.54518\) for \(y=4\), and \(2[2\log(2/3)-(2-3)]=2[2\log(2/3)+1]\approx0.37814\) for \(y=2\). Hence \(D\approx3.92332\) and \(D/\nu\approx1.96166\).

The zero count contributes \(2-1=1\) more to the deviance than to Pearson, while the other two observations contribute about \(-0.45482\) and \(0.04481\) to the difference \(D-X_P^2\). Their sum is approximately \(0.59000\), matching \(3.92332-3.33333\). This identifies the zero count as the main source of the disagreement.

Why the Contributions May Disagree

Both contributions are approximately quadratic when an observation lies close to its fitted mean. Farther away, the deviance reflects the asymmetry of the binomial or Poisson likelihood, while the Pearson contribution remains a squared residual divided by the fitted variance. The direction of the difference depends on the response and fitted mean; there is no universal rule that one statistic must be larger.

Result: For a fixed Poisson mean \(\mu>0\), let \(\delta=y-\mu\). As \(\delta\) approaches zero, \[ 2\left[y\log\left(\frac{y}{\mu}\right)-(y-\mu)\right] =\frac{\delta^2}{\mu}-\frac{\delta^3}{3\mu^2}+O(\delta^4). \] For a binomial group with fixed \(m\) and \(0<p<1\), let \(\delta=y-mp\). As \(\delta\) approaches zero, \[ 2\left[y\log\left(\frac{y}{mp}\right)+(m-y)\log\left(\frac{m-y}{m(1-p)}\right)\right] =\frac{\delta^2}{mp(1-p)} +\frac{(2p-1)\delta^3}{3m^2p^2(1-p)^2} +O(\delta^4). \] In each case, the quadratic term is the Pearson contribution.

Justification. For Poisson data, treat the deviance contribution as a function of a real argument \(y>0\), with \(\mu\) fixed. Its value and first derivative at \(y=\mu\) are zero; its second and third derivatives there are \(2/\mu\) and \(-2/\mu^2\). Taylor's theorem through the cubic term gives \(\delta^2/\mu-\delta^3/(3\mu^2)\). The fourth derivative is continuous and bounded on a sufficiently small closed interval around \(\mu>0\), so the remainder is \(O(\delta^4)\).

For the binomial expression, write \(q=y/m\). Its value as a function of \(q\) is \(2m[q\log(q/p)+(1-q)\log((1-q)/(1-p))]\). At \(q=p\), its value and first derivative are zero, and its second and third derivatives are \(2m/[p(1-p)]\) and \(2m(2p-1)/[p^2(1-p)^2]\). Substituting \(q-p=\delta/m\) into Taylor's theorem yields the stated expansion. Since \(p\) is strictly between zero and one, the function has bounded fourth derivative on a sufficiently small closed interval around \(p\), which justifies the remainder order. \(\square\)

The expansions explain local agreement, not agreement for every observation. For example, in the Poisson expansion the cubic term changes sign with \(\delta\): a large positive residual tends to make deviance smaller than Pearson locally, while a negative residual tends to make it larger. For binomial data, the fitted probability also affects the cubic term, and the exact contribution can be especially important near zero or \(m\). The Taylor approximations should not be used as numerical substitutes for the exact formulas when residuals are large or fitted probabilities are near the boundary.

Result: Let \(P_i\) and \(D_i\) denote the Pearson and deviance contributions for observation \(i\), calculated using the same fitted model. Then \[ D-X_P^2=\sum_{i=1}^{n}(D_i-P_i),\qquad \frac{D}{\nu}-\frac{X_P^2}{\nu}=\frac{1}{\nu}\sum_{i=1}^{n}(D_i-P_i), \] provided both ratios use the same positive residual degrees of freedom \(\nu\).

Proof. By definition, \(D=\sum_{i=1}^nD_i\) and \(X_P^2=\sum_{i=1}^nP_i\). Subtracting the sums gives \(D-X_P^2=\sum_i(D_i-P_i)\). Dividing both sides by the same positive \(\nu\) gives the ratio identity. Thus an overall difference is exactly the sum of the observation-level differences; a few contributions can dominate it, or positive and negative differences can offset one another. \(\square\)

How to Use the Comparison

A practical comparison should preserve the information that the totals discard. For each observation, calculate or inspect \(P_i\), \(D_i\), and \(D_i-P_i\), then identify the largest contributions and the largest signed differences. In grouped binomial data, retain the group sizes and fitted probabilities in the inspection; a response count cannot be interpreted apart from its denominator. In Poisson data with unequal exposure, compare counts with their fitted means, not with one another without accounting for exposure.

1
Check the setup.
Confirm that the same response units, fitted model, residual degrees of freedom, and zero-term conventions are used for both statistics.
2
Compare the totals and ratios.
Report \(X_P^2\), \(D\), \(\nu\), and both ratios. Treat disagreement as a diagnostic clue, not as proof that one statistic is wrong.
3
Inspect contributions.
Find the observations with the largest \(P_i\), \(D_i\), and \(|D_i-P_i|\), and note whether the difference comes from a few records or is spread across the data.
4
Interpret in context.
Check whether the influential contributions correspond to sparse outcomes, unusual fitted means, boundary responses, or a pattern in predictors or groupings that merits further investigation.

Common Mistake

A common error is to treat Pearson and deviance ratios as interchangeable readings of the same quantity, or to explain their difference using only the observation with the largest Pearson contribution. The ratios summarize sums, and individual deviations \(D_i-P_i\) can have either sign. A large contribution to one statistic does not automatically account for the difference between the totals; other observations may offset it or enlarge it.

The correction is to calculate both sets of contributions and add their signed differences. In the first worked example, the high-count observation has Pearson contribution \(4\) and deviance contribution about \(3.09035\). Those are that observation’s contributions, not the total Pearson statistic. The total Pearson statistic is \(8\), and the total deviance is about \(11.09035\), because the low count contributes \(8\) to deviance. The direction of the overall comparison is explained by the complete contribution sum.

Key takeaway: Pearson and deviance evidence is locally similar near fitted means but can differ substantially for individual observations. Compare the ratios, then use the signed, observation-level differences to locate and explain the disagreement.

Check Your Understanding

Use the definitions and comparison strategy to answer these questions.

  1. For a Poisson observation with \(y=0\) and fitted mean \(\hat{\mu}=3\), calculate its Pearson and deviance contributions.
  2. Why do Pearson and deviance contributions have the same leading term when the response is close to its fitted mean?
  3. In grouped binomial data, what information besides the observed number of successes is needed to calculate the two contributions?
  4. If \(D>X_P^2\), must the deviance contribution exceed the Pearson contribution for every observation? Explain.
  5. When the dispersion ratios disagree, what observation-level quantities would you inspect to identify the source?
Clinical Biostats