Tutorials › Generalized Linear Models › Interpreting Pearson and Deviance Disagreements

Goodness of Fit and Calibration · Tutorial 783 of 981

Interpreting Pearson and Deviance Disagreements

Compare Pearson and deviance contributions to understand when their overall fit assessments diverge and what the disagreement reveals.

Intermediate 10 min read

What You'll Learn

  • Define Pearson and deviance contributions for individual observations
  • Explain why the statistics are close for small residuals in the interior of the mean space
  • Calculate both contributions for Poisson and Bernoulli observations
  • Diagnose discrepancies caused by rare outcomes and boundary fitted means
  • Avoid treating disagreement between the statistics as a model-selection test

Why Two Goodness-of-Fit Statistics Can Disagree

Pearson and deviance statistics summarize the discrepancy between observed responses and fitted means, but they measure that discrepancy on different scales. When most observations are close to their fitted means and those means are away from the edges of their possible ranges, the statistics often tell a similar story. A few unusual observations or fitted means near a boundary can make them diverge sharply.

The useful diagnostic question is not only whether the two totals are large, but which observations contribute to each total and why. In particular, a rare outcome can be many variance units away from its fitted mean while producing a more moderate deviance contribution. Looking at the contributions helps distinguish that pattern from many small discrepancies spread across the data.

Definitions and Observation-Level Contributions

Consider independent responses \(Y_1,\ldots,Y_n\) from a GLM, with fitted means \(\hat{\mu}_i\). For the formulas below, assume unit weights and write \(V(\mu_i)\) for the variance function, so that \(\operatorname{Var}(Y_i)=\phi V(\mu_i)\) when the model includes a dispersion parameter \(\phi\). The unscaled Pearson statistic below uses \(V(\hat{\mu}_i)\), not \(\phi V(\hat{\mu}_i)\).

Definition: The Pearson contribution for observation \(i\) is \(X_i^2=(y_i-\hat{\mu}_i)^2/V(\hat{\mu}_i)\). The total Pearson goodness-of-fit statistic is \(X^2=\sum_{i=1}^n X_i^2\). The deviance contribution \(d(y_i,\hat{\mu}_i)\) is twice the log-likelihood difference between the saturated model for that observation and the fitted model. The total deviance is \(D=\sum_{i=1}^n d(y_i,\hat{\mu}_i)\).

A saturated model fits each observation exactly. Thus the deviance contribution measures the loss in log likelihood from using the fitted mean instead of that exact fit. For Poisson observations,

$$ d(y,\mu)=2\left\{y\log\left(\frac{y}{\mu}\right)-(y-\mu)\right\},\qquad y>0,\ \mu>0, $$

and \(d(0,\mu)=2\mu\). The convention \(0\log(0/\mu)=0\) makes this formula continuous at \(y=0\). For a Bernoulli observation \(y\in\{0,1\}\) with fitted success probability \(p\in(0,1)\), the Pearson and deviance contributions are

$$ X^2=\frac{(y-p)^2}{p(1-p)},\qquad d(y,p)=2\left\{y\log\left(\frac{y}{p}\right)+(1-y)\log\left(\frac{1-y}{1-p}\right)\right\}, $$

where zero-times-log terms are interpreted as zero. These are observation-level quantities. In grouped data, the formulas and the contribution attached to a row depend on the response representation; that distinction matters when interpreting a particular data table.

Worked Example: A Poisson Observation Near Its Fitted Mean

Suppose a Poisson observation is \(y=10\), with fitted mean \(\hat{\mu}=9.5\). Its Pearson contribution is

$$ X_i^2=\frac{(10-9.5)^2}{9.5} =\frac{0.25}{9.5} \approx 0.0263158. $$

For the deviance contribution, \(y/\hat{\mu}=10/9.5=20/19\), so

$$ d(10,9.5) =2\left\{10\log\left(\frac{20}{19}\right)-0.5\right\} \approx 0.0258659. $$

Both contributions are small and similar. Here the observation is close to its fitted mean, and neither statistic signals a substantial discrepancy. The calculation also shows why it is worth retaining enough precision when reporting a small contribution: \(0.0258659\) rounds to \(0.02587\) at five decimal places.

Why the Measures Usually Agree Locally

For a regular exponential-dispersion GLM with a positive variance function \(V\), its unit deviance has the representation

$$ d(y,\mu)=2\int_{\mu}^{y}\frac{y-t}{V(t)}\,dt. $$

This formula applies when the integral is defined between the observed response \(y\) and the mean \(\mu\); the orientation of the integral gives a nonnegative value on either side of \(\mu\). It follows, for example, by differentiating the unit deviance with respect to \(\mu\): its derivative is \(2(\mu-y)/V(\mu)\), and its value at \(\mu=y\) is zero.

Result: If \(V\) is continuous and positive in a neighborhood of an interior mean \(\mu\), then as \(y\) approaches \(\mu\), \[ d(y,\mu)=\frac{(y-\mu)^2}{V(\mu)}+o\big((y-\mu)^2\big). \] Thus the deviance and Pearson contributions agree to second order for a small discrepancy at an interior mean.

To verify the result, put \(\delta=y-\mu\) and change variables in the integral using \(t=\mu+u\delta\). This gives

$$ d(y,\mu)=2\delta^2\int_0^1\frac{1-u}{V(\mu+u\delta)}\,du. $$

By continuity and positivity of \(V\) at \(\mu\), \(1/V(\mu+u\delta)\) converges uniformly over \(0\leq u\leq1\) to \(1/V(\mu)\) as \(\delta\to0\). Therefore the integral converges to

$$ \frac{1}{V(\mu)}\int_0^1(1-u)\,du =\frac{1}{2V(\mu)}. $$

Substitution yields \(d(y,\mu)/\delta^2\to1/V(\mu)\), which proves the expansion. The Pearson contribution is exactly \(\delta^2/V(\mu)\), so the two contributions have the same leading term. The interior and continuity conditions are important: this local approximation does not promise close agreement for large residuals or near a boundary where \(V(\mu)\) approaches zero. \(\square\)

Rare Outcomes and Boundary Fitted Means

A Bernoulli observation makes the boundary issue especially clear. If \(y=1\), then

$$ X^2=\frac{1-p}{p},\qquad d(1,p)=2\log\left(\frac{1}{p}\right). $$

As \(p\) approaches zero, the fitted mean is near the boundary for a success. The Pearson contribution grows at order \(1/p\), while the deviance grows only at order \(\log(1/p)\). Their ratio diverges: \(X^2/d(1,p)=(1-p)/\{2p\log(1/p)\}\to\infty\). The same pattern occurs for an observed failure when \(p\) approaches one: writing \(q=1-p\), the contributions are \(p/(1-p)\) and \(-2\log(1-p)\), respectively, and their ratio also diverges.

Worked Example: A Rare Success Under a Small Fitted Probability

For a Bernoulli observation \(y=1\) with fitted probability \(p=0.01\), the Pearson contribution is

$$ X^2=\frac{(1-0.01)^2}{0.01(0.99)} =\frac{0.9801}{0.0099} =99. $$

The deviance contribution is

$$ d(1,0.01)=2\log(100)\approx 9.210340. $$

Both statistics identify a discrepancy, but the Pearson contribution is much larger. The observed success is a rare outcome under the fitted probability, making the squared discrepancy large relative to the small Bernoulli variance. Deviance also penalizes the mismatch, but increases logarithmically as the fitted probability approaches zero.

A Poisson example shows the same mechanism. When \(y=1\) and \(\mu=0.001\), the outcome is rare under the fitted mean. The two contributions are

$$ X^2=\frac{(1-0.001)^2}{0.001}=998.001, \qquad d(1,0.001)=2\{\log(1000)-0.999\}\approx11.8175106. $$

The calculations do not mean that deviance is a universal correction for rare observations, or that Pearson should be ignored. They show that the two statistics encode different magnitudes for an observation that is far from a small fitted mean. In practice, inspect the response, fitted mean, and both contributions before deciding what the discrepancy indicates.

Worked Example: How a Few Contributions Affect the Totals

Consider three Bernoulli observations with outcomes \((1,0,1)\) and fitted probabilities \((0.01,0.99,0.5)\), respectively. These are specified fitted values for illustrating the arithmetic. For the first observation, \(y=1,p=0.01\), the contributions are \(99\) and \(2\log(100)\approx9.210340\). For the second, \(y=0,p=0.99\), they are also \(99\) and \(-2\log(0.01)\approx9.210340\). For the third, \(y=1,p=0.5\), they are

$$ X^2=\frac{(1-0.5)^2}{0.5(0.5)}=1,\qquad d(1,0.5)=2\log(2)\approx1.386294. $$

Adding the contributions gives

$$ X^2=99+99+1=199,\qquad D\approx9.210340+9.210340+1.386294=19.8070. $$

The two unusual outcomes dominate the Pearson total more strongly than the deviance total. The totals alone conceal this concentration: the contribution table reveals exactly where the disagreement comes from. These values illustrate the calculation, not a claim that every such set of probabilities can arise from every fitted model.

How to Interpret a Disagreement

Pearson and deviance goodness-of-fit statistics are commonly compared with reference distributions under specified large-sample conditions, as discussed in the earlier material on residual degrees of freedom and reference distributions. A difference between their values is not, by itself, a formal test comparing two models or a rule that one statistic is correct and the other is not. Their reference approximations also need not be equally reliable in every data configuration.

When the conclusions differ, begin with the observation-level contributions. A large Pearson statistic relative to deviance may be driven by one or more responses far from small fitted means, especially rare binary outcomes or counts. Several moderate discrepancies can also add up differently because Pearson squares standardized residuals, whereas deviance reflects a log-likelihood difference. The residual and fitted-mean context matters; the totals do not identify a cause on their own.

1
Calculate both contributions.
Use the response distribution and the appropriate variance function and unit deviance. Do not substitute formulas for a different response representation.
2
Locate the influential terms in each sum.
List or plot \(X_i^2\) and \(d(y_i,\hat{\mu}_i)\). Check whether a small number of observations dominate one statistic.
3
Check the fitted means and outcomes.
Look for rare outcomes, means near their allowed boundaries, and observations far from their fitted means.
4
Interpret with the reference conditions in mind.
Report the disagreement and its contribution pattern; do not treat it as automatic proof of a particular model failure.

Common Mistake

A common mistake is to conclude that the statistic with the larger numerical value must provide the more trustworthy fit assessment, or that the smaller one shows the model fits adequately. This reasoning ignores both the distinct scales of the contributions and the conditions behind the reference distributions. A Pearson total dominated by a single rare outcome may tell a different diagnostic story from a deviance total spread across many observations.

The correction is to examine the contribution-level pattern, then interpret it in the context of the response type, fitted means, and applicable reference assumptions. Similar statistics for small interior residuals are expected from their common second-order approximation. A substantial disagreement can be informative, but it is a prompt for diagnosis, not a verdict by itself.

Key takeaway: Pearson and deviance contributions are locally similar near an interior fitted mean, but can differ sharply for large residuals and boundary means. Diagnose disagreement by tracing the totals back to the observations that produce them.

Check Your Understanding

Use the contribution formulas and boundary behavior to answer the following questions.

  1. For a Poisson observation with \(y=0\) and fitted mean \(\mu>0\), derive its Pearson and deviance contributions.
  2. For a Bernoulli success, explain what happens to the Pearson and deviance contributions as the fitted probability approaches zero.
  3. Why does the local approximation between deviance and Pearson contributions require an interior mean with a positive, continuous variance function?
  4. If the Pearson total is much larger than the deviance total, what observation-level quantities would you inspect first?
  5. Why is disagreement between the two totals not, on its own, a formal test comparing models?
Clinical Biostats