Why Scale a GLM Response Residual?
A response residual is the observed value minus its fitted mean. But a difference of 3 does not have the same significance for every observation. For a Poisson count with fitted mean 4, a difference of 3 is substantial relative to the model's variability; for a count with fitted mean 100, the same difference is comparatively small. A Pearson residual accounts for this by dividing the response residual by its model-based standard deviation.
This scaling matters whenever response variance changes with the mean, as it does in common generalized linear models (GLMs). It puts residuals on a scale where their magnitudes can be compared more meaningfully across observations. The calculation depends on the response's distribution, the GLM variance function, and any dispersion or observation weights.
For unit weights, the formula reduces to \((y_i-\hat{\mu}_i)/\sqrt{\hat{\phi}V(\hat{\mu}_i)}\). When the dispersion is fixed at 1, as in the usual Poisson and binomial GLMs, it reduces further to \((y_i-\hat{\mu}_i)/\sqrt{V(\hat{\mu}_i)}\). Some presentations call the residual with \(\phi\) omitted the Pearson residual and use the term scaled Pearson residual when \(\phi\) is included. Always check the stated convention; the appropriate variance determines the denominator.
For grouped binomial data, the response scale also matters. If \(Y_i\) is the number of successes in \(n_i\) trials, then \(V(\mu_i)=\mu_i(1-\mu_i/n_i)\) when expressed as a count, and the variance is \(\mu_i(1-\mu_i/n_i)\) for a binomial count. Equivalently, if the response is the observed proportion \(Y_i/n_i\), its variance is \(p_i(1-p_i)/n_i\). These are two representations of the same uncertainty; do not combine a proportion residual with a count variance.
The Variance Function Sets the Scale
For a GLM, the variance function describes how response variability changes with the mean. In a Poisson model, \(\operatorname{Var}(Y_i)=\mu_i\). In a binomial model with \(n_i\) trials and success probability \(p_i\), \(\operatorname{Var}(Y_i)=n_i p_i(1-p_i)\) for the count. In a Gamma model, \(\operatorname{Var}(Y_i)=\phi\mu_i^2\). These formulas apply under the respective model assumptions; the denominator should not be chosen simply because a different model is familiar.
A Pearson residual preserves the sign of the response error: it is positive when the observed response exceeds its fitted mean and negative when it falls below. Its magnitude expresses the error in units of the fitted standard deviation. It does not, by itself, make residuals exactly normally distributed, nor does this calculation adjust for the fact that model parameters were estimated from the data.
Worked Example: Poisson Counts With Different Fitted Means
A hypothetical insurer models claim counts using a Poisson GLM with a log link and an exposure offset. Assume conditionally independent counts, unit weights, and fixed dispersion \(\phi=1\). For two policies, the fitted claim rate is 1.5 claims per exposure unit. Policy A has exposure 2 and observed count 5; Policy B has exposure 4 and observed count 4. Calculate both Pearson residuals and compare them.
Method. Under this Poisson model, the fitted mean count is exposure times fitted rate, and the variance of each count equals its fitted mean. Thus \(r_{P,i}=(y_i-\hat{\mu}_i)/\sqrt{\hat{\mu}_i}\).
Policy A. Its fitted mean is \(2(1.5)=3\). The response residual is \(5-3=2\), and the fitted standard deviation is \(\sqrt{3}\). Therefore, $$ r_{P,A}=\frac{2}{\sqrt{3}}=1.1547. $$
Policy B. Its fitted mean is \(4(1.5)=6\). The response residual is \(4-6=-2\), and the fitted standard deviation is \(\sqrt{6}\). Therefore, $$ r_{P,B}=\frac{-2}{\sqrt{6}}=-0.8165. $$
The raw residuals have equal magnitude, 2, but the Pearson residuals do not: Policy A's residual is larger in magnitude because its fitted count variance is smaller. The signs also identify the direction of each error: Policy A had more claims than fitted, while Policy B had fewer. The common mistake is to compare only the raw differences and ignore the distinct fitted variances.
Worked Example: Grouped Binomial Counts and Trial Numbers
A hypothetical health program models the number of participants who complete a screening as binomial, with success probability \(p=0.5\) for each participant. Assume independent trials, no extra-binomial dispersion, and unit weights. Group A has 10 participants and 8 completions; Group B has 100 participants and 53 completions. Calculate the count-scale Pearson residual for each group and explain why the raw residuals alone are misleading.
Method. For a binomial count \(Y_i\sim\operatorname{Binomial}(n_i,p_i)\), the fitted mean is \(n_i p_i\), and the variance is \(n_i p_i(1-p_i)\). Here \(p_i=0.5\) for both groups.
Group A. Its fitted mean is \(10(0.5)=5\), so its response residual is \(8-5=3\). Its variance is \(10(0.5)(0.5)=2.5\), and its standard deviation is \(\sqrt{2.5}=1.5811\). Thus, $$ r_{P,A}=\frac{3}{\sqrt{2.5}}=1.8974. $$
Group B. Its fitted mean is \(100(0.5)=50\), so its response residual is \(53-50=3\). Its variance is \(100(0.5)(0.5)=25\), and its standard deviation is \(\sqrt{25}=5\). Thus, $$ r_{P,B}=\frac{3}{5}=0.6000. $$
Both groups exceed their fitted means by 3 completions, but the same difference is much less unusual relative to the model-based variability in the group of 100. The Pearson residuals show this difference in scale. The common mistake is to divide both count residuals by the same standard deviation, or to treat the two groups as equally precise despite their different trial counts.
Worked Example: Gamma Responses With Mean-Dependent Variance
A hypothetical severity model assumes independent Gamma responses with a log link and variance \(\operatorname{Var}(Y_i)=\phi\mu_i^2\). The dispersion is known to be \(\phi=0.25\), and the observation weights are 1. For two policies, the fitted means and observed severities are: Policy C, \(\hat{\mu}=200\), \(y=260\); Policy D, \(\hat{\mu}=50\), \(y=80\). Calculate their scaled Pearson residuals. Assume the Gamma parameterization has shape \(1/\phi\) and scale \(\phi\mu_i\), which gives mean \(\mu_i\) and variance \(\phi\mu_i^2\).
Method. The fitted variance is \(\phi\hat{\mu}_i^2\), so the fitted standard deviation is \(\sqrt{\phi}\hat{\mu}_i\), since \(\phi>0\) and fitted means are positive.
Policy C. The response residual is \(260-200=60\). The fitted variance is \(0.25(200)^2=0.25(40{,}000)=10{,}000\), giving standard deviation \(\sqrt{10{,}000}=100\). Therefore, $$ r_{P,C}=\frac{60}{100}=0.6000. $$
Policy D. The response residual is \(80-50=30\). The fitted variance is \(0.25(50)^2=0.25(2{,}500)=625\), giving standard deviation \(\sqrt{625}=25\). Therefore, $$ r_{P,D}=\frac{30}{25}=1.2000. $$
Policy D has the smaller raw error, 30 rather than 60, but the larger Pearson residual because its fitted standard deviation is smaller. The common mistake is to use a Poisson denominator such as \(\sqrt{\hat{\mu}}\), even though the specified Gamma variance is proportional to the square of the mean.
Why the Scaling Works
The justification is a direct consequence of standardizing by the conditional standard deviation. For an observation whose true mean is \(\mu_i\), suppose the model correctly specifies its conditional variance as \(\phi V(\mu_i)/w_i\). The response error \(Y_i-\mu_i\) has conditional expectation zero and conditional variance equal to that stated variance. Dividing by its standard deviation therefore gives a quantity with conditional mean zero and variance one.
Under the correctly specified conditional mean, \(E[Y_i-\mu_i\mid x_i]=0\), where \(x_i\) denotes the predictors for observation \(i\).
By assumption, \(\operatorname{Var}(Y_i\mid x_i)=\phi V(\mu_i)/w_i\). The corresponding standard deviation is \(\sqrt{\phi V(\mu_i)/w_i}\).
For \(R_i=(Y_i-\mu_i)/\sqrt{\phi V(\mu_i)/w_i}\), the conditional mean is zero and its conditional variance is $$ \operatorname{Var}(R_i\mid x_i)=\frac{\phi V(\mu_i)/w_i}{\phi V(\mu_i)/w_i}=1. $$ This explains why the scaling makes residual magnitudes more comparable across unequal variances.
In practice, Pearson residuals use fitted means and often an estimated dispersion, rather than the unknown true values. The zero-mean and unit-variance calculation above is therefore the model-based rationale, not a guarantee that fitted residuals have exactly those properties in a finite sample. The result also does not imply a normal distribution: unit variance and mean zero alone do not establish normality.
Pearson Residuals and the Pearson Goodness-of-Fit Statistic
For unit weights, squaring the Pearson residual removes its sign and gives the observation's contribution to the Pearson statistic under the corresponding dispersion convention. In particular, if the dispersion is omitted from each residual, then summing squared residuals gives the Pearson chi-square statistic. If the residuals include \(\hat{\phi}\), their squared sum is the statistic divided by \(\hat{\phi}\).
These identities follow by squaring the residual definition: each squared denominator is \(\hat{\phi}V(\hat{\mu}_i)/w_i\), so its contribution is the corresponding Pearson-statistic contribution divided by \(\hat{\phi}\). When \(\phi=1\), the two sums coincide. This connection is useful, but a single large residual and the aggregate statistic answer different questions: the former identifies a large casewise discrepancy, while the latter accumulates discrepancies over observations.
Do not confuse a Pearson residual with a deviance residual. Both retain a sign based on whether \(y_i\) is above or below \(\hat{\mu}_i\), but the deviance residual is based on a likelihood-based contribution, whereas the Pearson residual uses the variance function directly. Also, the Pearson residual defined here does not include an adjustment for leverage or for parameter estimation. Those are separate refinements and should not be silently inserted into this calculation.
Common Mistakes and a Reliable Calculation Routine
Most errors arise from using a plausible-looking denominator that does not match the response and model. Before computing a Pearson residual, identify what was recorded (a count, a proportion, or a positive continuous response), state the fitted mean and variance under the assumed model, and check weights and dispersion.
- Use the specified variance function. A Poisson mean implies variance \(\mu\); a Gamma mean implies variance \(\phi\mu^2\). Do not substitute one for the other.
- Keep the response scale consistent. A grouped-binomial count and a grouped-binomial proportion have different variances.
- Track dispersion and weights. Include \(\phi\) and \(w_i\) when the model or stated convention requires them.
- Retain the sign. A positive residual means the observation exceeds its fitted mean; a negative one means it falls below.
- Interpret magnitude relative to the model. A large raw error need not be a large Pearson residual if the model also predicts high variability.
A useful final check is dimensional and directional: the numerator and denominator must be on the same response scale, the denominator must be positive, and the result's sign must match \(y_i-\hat{\mu}_i\). If changing the observation's exposure or trial count changes the model-based variance, the residual scale should reflect that change.
Check Your Understanding
For each problem, choose the variance on the stated response scale before calculating.
- A hypothetical Poisson model has a fitted mean count of 8 and dispersion 1. An observation is 11. Calculate its Pearson residual. (Answer: \(3/\sqrt{8}=1.0607\).)
- A hypothetical binomial count has 25 trials and fitted success probability 0.4. If 14 successes are observed, calculate the count-scale Pearson residual, assuming no extra-binomial dispersion. (Answer: \(4/\sqrt{6}=1.6330\).)
- A group of 16 hypothetical trials has fitted success probability 0.75 and observed proportion \(9/16\). Calculate the proportion-scale Pearson residual, assuming no extra-binomial dispersion. (Answer: \(-\sqrt{3}=-1.7321\).)
- A hypothetical Gamma response has fitted mean 150, observed value 174, dispersion 0.16, and unit weight. Calculate its scaled Pearson residual. (Answer: \(24/\sqrt{0.16(150)^2}=0.4000\).)
- A Poisson rate model predicts 0.8 claims per exposure unit for two hypothetical policies. Policy A has exposure 5 and count 1; Policy B has exposure 20 and count 13. Calculate both Pearson residuals and identify which has the larger absolute residual. Assume dispersion 1. (Answer: Policy A: \(-3/\sqrt{4}=-1.5000\); Policy B: \(-3/\sqrt{16}=-0.7500\); Policy A has the larger absolute residual.)