Tutorials › Generalized Linear Models › Dispersion Scaling of Pearson and Deviance Residuals

Residuals and Deviance · Tutorial 749 of 981

Dispersion Scaling of Pearson and Deviance Residuals

See how dispersion changes the scale of Pearson and deviance residuals, and why scaling does not by itself make fitted residuals standard normal.

Intermediate 10 min read

What You'll Learn

  • Define unscaled Pearson and deviance residuals using the fitted mean and unit-dispersion variance or deviance
  • Derive how known and estimated dispersion rescale both kinds of residuals
  • Interpret the Gaussian case, where the unscaled Pearson and deviance residuals coincide
  • Calculate scaled and unscaled residuals for Gaussian, grouped-binomial, and Gamma examples
  • Distinguish residual scaling from claims that residuals are independent or standard normal

Why Dispersion Changes Residual Scale

Pearson and deviance residuals measure discrepancies between observed responses and fitted means. In a dispersion model, however, the variance has an additional scale factor: a model with larger dispersion allows more response variation around the same mean. A residual computed without that factor and one divided by its square root therefore answer related but different questions. The unscaled quantity measures discrepancy relative to the unit-dispersion model; the scaled quantity measures it relative to the model's stated dispersion.

The distinction matters in Gaussian models, where dispersion is the error variance, and in other models that allow a dispersion parameter, such as quasi-binomial and quasi-Poisson models. It also prevents a common overinterpretation: dividing a fitted residual by an estimated standard deviation does not, by itself, make that residual exactly standard normal.

Definitions: Unscaled and Scaled Residuals

For independent observations with unit prior weights, suppose the mean-variance specification is \(\operatorname{Var}(Y_i)=\phi V(\mu_i)\), where \(\mu_i=E[Y_i]\), \(V(\mu_i)\) is the variance function, and \(\phi>0\) is the dispersion. In a fitted model, write \(\hat\mu_i\) for the fitted mean and \(\hat\phi\) for an estimated dispersion; when dispersion is known, use its known value in place of \(\hat\phi\). All residual formulas below evaluate the model variance at the fitted mean. This is a plug-in calculation, not a claim that the conditional variance given the data-dependent \(\hat\mu_i\) equals \(\phi V(\hat\mu_i)\).

Definition: The unscaled Pearson residual is \(r_{P,i}=(y_i-\hat\mu_i)/\sqrt{V(\hat\mu_i)}\). The Pearson residual scaled by dispersion is \(r_{P,i}^{(s)}=r_{P,i}/\sqrt{\phi}\), or \(r_{P,i}/\sqrt{\hat\phi}\) when dispersion is estimated. Thus the scaled Pearson residual is the plug-in standardized discrepancy \((y_i-\hat\mu_i)/\sqrt{\phi V(\hat\mu_i)}\).

The square root in the denominator is the model standard deviation evaluated at the fitted mean, with dispersion included for the scaled version. If known prior weights \(w_i\) are part of the model and \(\operatorname{Var}(Y_i)=\phi V(\mu_i)/w_i\), the corresponding Pearson residuals are multiplied by \(\sqrt{w_i}\). The examples below use unit weights.

For deviance residuals, let \(d_i=d(y_i,\hat\mu_i)\) denote the unit deviance contribution: the contribution calculated under unit dispersion. Its signed square root retains the direction of the discrepancy.

Definition: The unscaled deviance residual is \(r_{D,i}=\operatorname{sign}(y_i-\hat\mu_i)\sqrt{d_i}\). The deviance residual scaled by dispersion is \(r_{D,i}^{(s)}=r_{D,i}/\sqrt{\phi}\), or \(r_{D,i}/\sqrt{\hat\phi}\) if dispersion is estimated. The sign convention is immaterial when \(y_i=\hat\mu_i\), because both residuals are then zero.

The unscaled residual deviance is \(D=\sum_i d_i=\sum_i r_{D,i}^2\). The corresponding scaled sum of squared deviance residuals is \(D/\phi=\sum_i (r_{D,i}^{(s)})^2\). Likewise, the Pearson statistic is \(X_P^2=\sum_i r_{P,i}^2\), and its dispersion-scaled version is \(X_P^2/\phi=\sum_i (r_{P,i}^{(s)})^2\). These identities describe a common scaling convention; software and texts may call either the unit-dispersion or dispersion-adjusted quantity a “deviance residual,” so it is important to state which one is meant.

Why Both Residuals Divide by the Square Root

Dispersion multiplies a variance, while a residual is on a standard-deviation scale. The following algebra gives the scaling identities directly.

Result: At fixed fitted means, scaling the variance from \(V(\hat\mu_i)\) to \(\phi V(\hat\mu_i)\) divides the Pearson residual by \(\sqrt{\phi}\). If the deviance contribution is defined at unit dispersion, the corresponding scaled deviance residual is also the unscaled deviance residual divided by \(\sqrt{\phi}\).
1
Pearson scaling.
By definition, \(r_{P,i}=(y_i-\hat\mu_i)/\sqrt{V(\hat\mu_i)}\). Dividing instead by the model standard deviation evaluated at \(\hat\mu_i\), \(\sqrt{\phi V(\hat\mu_i)}\), gives \(r_{P,i}/\sqrt{\phi}\).
2
Deviance scaling.
The scaled deviance contribution is \(d_i/\phi\). Its signed square root is \(\operatorname{sign}(y_i-\hat\mu_i)\sqrt{d_i/\phi}=r_{D,i}/\sqrt{\phi}\), since \(\phi>0\).
3
Summing squares.
Summing the squared residuals gives \(\sum_i(r_{P,i}^{(s)})^2=X_P^2/\phi\) and \(\sum_i(r_{D,i}^{(s)})^2=D/\phi\). Replacing \(\phi\) by \(\hat\phi>0\) gives the corresponding plug-in identities.

For a regular exponential-dispersion model, the deviance scaling also follows from the likelihood. Suppose the density or mass function has the form \(f(y;\theta,\phi)=\exp\{[y\theta-b(\theta)]/\phi+c(y,\phi)\}\), with \(\phi>0\). Assume that a saturated fit is defined for the observed responses, and that the fitted and saturated likelihoods use the same dispersion. For each observation, let \(\theta_i\) be the fitted natural parameter and \(\theta(y_i)\) the saturated natural parameter corresponding to mean \(y_i\), with boundary cases interpreted by limits when needed. The twice-log-likelihood difference for observation \(i\) is

$$ 2\{\ell_{\mathrm{sat},i}-\ell_{\mathrm{fit},i}\} = \frac{2}{\phi}\left[ y_i\{\theta(y_i)-\theta_i\} -\{b(\theta(y_i))-b(\theta_i)\} \right] = \frac{d_i}{\phi}. $$

The terms \(c(y_i,\phi)\) cancel because the observed response and dispersion are the same in both likelihood evaluations. The bracketed expression, multiplied by two, is the unit deviance contribution. Consequently, the likelihood deviance is \(D/\phi\), and its signed observation-level square roots are the scaled deviance residuals just defined.

Theorem: Under the exponential-dispersion and saturated-fit conditions just stated, the likelihood deviance equals \(D/\phi\), where \(D\) is the sum of unit deviance contributions. Its signed observation-level contributions are \(r_{D,i}/\sqrt{\phi}\). If \(\phi\) is estimated, these are plug-in scaled residuals, not likelihood deviance contributions evaluated at a known true dispersion.

Worked Calculations

Worked Example: Gaussian Residuals

Suppose a Gaussian model has fitted mean \(\hat\mu_i=8\) for an observation \(y_i=10\), and the known variance is \(\phi=4\). For the Gaussian family \(V(\mu)=1\). The unscaled Pearson residual is \(r_{P,i}=(10-8)/\sqrt{1}=2\). The scaled Pearson residual is \(r_{P,i}^{(s)}=2/\sqrt{4}=1\).

The unit deviance contribution for a Gaussian response is \(d_i=(y_i-\hat\mu_i)^2\), so \(d_i=(10-8)^2=4\). Thus \(r_{D,i}=+\sqrt{4}=2\), with a positive sign because \(10>8\). The scaled deviance residual is \(r_{D,i}^{(s)}=2/\sqrt{4}=1\). Here the two unscaled residuals coincide, as do the two scaled residuals. If the variance were estimated rather than known, replacing \(4\) by \(\hat\phi\) would give plug-in residuals, not an exact standardization result.

Worked Example: A Grouped Quasi-Binomial Observation

Among \(n_i=10\) trials, suppose 6 successes are observed and the fitted success probability is \(\hat p_i=0.4\). The observed proportion is \(y_i=0.6\). The unit-dispersion variance of this proportion is \(\hat p_i(1-\hat p_i)/n_i=0.4(0.6)/10=0.024\). The unscaled Pearson residual is therefore \(r_{P,i}=(0.6-0.4)/\sqrt{0.024}=0.2/0.15492\approx1.291\). For \(\hat\phi=1.5\), the scaled value is \(1.291/\sqrt{1.5}\approx1.054\). Equivalently, the scaled denominator is \(\sqrt{1.5(0.024)}=\sqrt{0.036}\), giving \(0.2/\sqrt{0.036}\approx1.054\).

The grouped-binomial unit deviance contribution is \(d_i=2n_i[y_i\log(y_i/\hat p_i)+(1-y_i)\log\{(1-y_i)/(1-\hat p_i)\}]\). Substitution gives \(d_i=20[0.6\log(1.5)+0.4\log(0.4/0.6)]\). Using \(\log(1.5)\approx0.405465\) and \(\log(2/3)\approx-0.405465\), the bracket is \(0.6(0.405465)+0.4(-0.405465)=0.081093\), so \(d_i\approx1.62186\). Since the observed proportion exceeds the fitted probability, \(r_{D,i}=+\sqrt{1.62186}\approx1.2735\). Scaling gives \(r_{D,i}^{(s)}=1.2735/\sqrt{1.5}\approx1.0398\). The Pearson and deviance residuals are not equal, though both are reduced by the same factor.

Worked Example: A Gamma Observation

Suppose a Gamma model has \(y_i=6\), \(\hat\mu_i=4\), and \(\hat\phi=0.25\). For the Gamma variance function \(V(\mu)=\mu^2\), the unscaled Pearson residual is \(r_{P,i}=(6-4)/\sqrt{4^2}=2/4=0.5\). Its scaled version is \(0.5/\sqrt{0.25}=0.5/0.5=1\).

The Gamma unit deviance contribution is \(d_i=2[(y_i-\hat\mu_i)/\hat\mu_i-\log(y_i/\hat\mu_i)]\). Here \(d_i=2[2/4-\log(6/4)]=2[0.5-0.405465]\approx0.18907\). The observation exceeds its fitted mean, so \(r_{D,i}=+\sqrt{0.18907}\approx0.4348\). The scaled deviance residual is \(0.4348/0.5\approx0.8696\). This example shows that the Pearson and deviance residuals can differ in magnitude even before scaling.

Fixed Dispersion, Estimated Dispersion, and Interpretation

Some GLM families conventionally fix dispersion at one. In an ordinary Poisson or binomial model, the usual residuals are therefore the unit-dispersion residuals, and there is no extra free dispersion estimate to insert. Quasi-Poisson and quasi-binomial specifications allow a dispersion factor in the variance model; their Pearson residuals can be scaled using that factor. A quasi-likelihood model does not supply the ordinary full likelihood deviance in the same way as a likelihood model, so the meaning of a deviance residual depends on the unit-deviance convention being used. State whether a reported deviance residual is unit-dispersion or divided by \(\sqrt{\hat\phi}\).

In a Gaussian model, the unit deviance is squared error and \(V(\mu)=1\), so Pearson and deviance residuals coincide before scaling. In other families, their constructions differ: Pearson residuals use the variance function, while deviance residuals use a likelihood-based or specified unit-deviance contribution. Dispersion changes the scale of either by the same square-root factor, but does not make the two definitions identical.

If \(\phi\) is estimated from the data, scaled residuals inherit the uncertainty in \(\hat\phi\). Further, fitted means are estimated from the same responses whose residuals are being examined. The scaled residuals are not generally independent standard normal variables: fitting induces dependence, and binomial or count responses remain discrete. Residual scaling is a unit adjustment, not a guarantee of a reference distribution or a complete diagnostic procedure.

Common Mistake

A tempting but incorrect argument is: “Because the fitted mean is \(\hat\mu_i\), the conditional variance is \(\operatorname{Var}(Y_i\mid\hat\mu_i)=\phi V(\hat\mu_i)\), so the scaled Pearson residual is an exact conditional standardization.” In general, \(\hat\mu_i\) is data-dependent, and conditioning on it can change the distribution of \(Y_i\). The variance-model formula specifies the model variance as a function of the mean parameter; evaluating it at the fitted mean produces a plug-in model standard deviation, not necessarily the conditional standard deviation given the fitted value. Write the calculation as \((y_i-\hat\mu_i)/\sqrt{\hat\phi V(\hat\mu_i)}\) and describe it as a dispersion-scaled plug-in Pearson residual.

A second related error is to multiply a residual by \(\phi\). Since variance is multiplied by \(\phi\), standard deviation is multiplied by \(\sqrt{\phi}\); consequently the residual is divided by \(\sqrt{\phi}\). If \(\phi>1\), the scaled residual has no larger absolute value than the unscaled residual, and has strictly smaller absolute value when the unscaled residual is nonzero.

Key takeaway: Pearson and deviance residuals have unit-dispersion and dispersion-scaled versions. For either kind, scaling divides by \(\sqrt{\phi}\) (or \(\sqrt{\hat\phi}\)); it adjusts the residual's model scale but does not establish normality, independence, or exact conditional standardization.

Check Your Understanding

Use the distinction between unit-dispersion and scaled residuals to answer these questions.

  1. If a unit-dispersion Pearson residual is \(-3\) and the known dispersion is \(4\), what is its scaled value?
  2. For a Gaussian model with \(V(\mu)=1\), explain why the unscaled Pearson and deviance residuals coincide.
  3. Why is \((y_i-\hat\mu_i)/\sqrt{\hat\phi V(\hat\mu_i)}\) described as a plug-in standardization rather than necessarily an exact conditional standardization?
  4. If \(\hat\phi=2\), how do the sums of squared scaled Pearson residuals and scaled deviance residuals relate to their unscaled statistics?
  5. Does dividing a residual by \(\sqrt{\hat\phi}\) imply that it is standard normal? Give one reason why not.
Clinical Biostats