Why Scale a Response Residual?
A response residual is the observed outcome minus its fitted mean. But a difference of one has different significance in different parts of a GLMM: for a rare binary outcome it may be large, while for a count with a large expected value it may be small. Pearson residuals address this by expressing the difference in units of the model-implied standard deviation.
In a GLMM, that scale depends on the chosen conditioning. A conditional fitted mean uses a specified value of the random effects; a marginal fitted mean averages over their distribution. The corresponding variances are not generally the same. This tutorial focuses on how to derive and interpret Pearson residuals on either clearly stated scale, and on why discrete residuals need not resemble continuous normal data.
For a conventional GLMM, the response distribution is specified conditionally on random effects. Write \(b\) for the random effects and \(\mu_{ij}(b)=E(Y_{ij}\mid b)\) for the conditional mean. If the conditional variance is \(\operatorname{Var}(Y_{ij}\mid b)=\phi V(\mu_{ij}(b))\), the conditional Pearson residual evaluated at fitted parameters and fitted random effects is
Here \(\hat b\) denotes the fitted random effects, \(V(\cdot)\) is the family’s variance function, and \(\phi\) is a dispersion factor when the model includes one. For Bernoulli, binomial, and Poisson models, the standard variance specifications usually have \(\phi=1\). A different scale is appropriate if the model explicitly allows a different conditional variance.
Deriving the Common Discrete-Outcome Forms
The derivation is direct: specify the conditional mean and variance for the outcome, substitute them in the Pearson-residual definition, and simplify. These formulas apply when the stated response distribution and its variance are appropriate conditional on the random effects. In a standard GLMM, observations are assumed conditionally independent given those effects, unless the model specifies additional dependence.
For grouped binomial data, \(y_{ij}\) is the observed number of successes out of \(m_{ij}\) trials, not the observed proportion. If the data are instead recorded as a proportion \(y_{ij}/m_{ij}\), both the residual and its variance must be expressed on the proportion scale. Mixing a count numerator with a proportion-scale denominator gives an incorrect residual.
Worked Example: A Bernoulli Outcome With a Rare Fitted Event
Suppose a hypothetical observation has fitted conditional event probability \(\hat p=0.08\), and the observed outcome is \(y=1\). The fitted Bernoulli variance is $$ \hat p(1-\hat p)=0.08(0.92)=0.0736, $$ so the fitted standard deviation is \(\sqrt{0.0736}=0.2713\). The response residual is \(1-0.08=0.92\), and therefore $$ r_P=\frac{1-0.08}{\sqrt{0.08(0.92)}}=\frac{0.92}{0.2713}=3.391. $$
This is a large positive residual: the observed event is less expected under a fitted probability of 0.08 than the outcome \(y=0\) would be. It is not a probability or a count of standard deviations from a normal distribution. Its value is large because an event is unusual under this fitted Bernoulli probability.
For comparison, if \(y=0\) with the same fitted probability, then $$ r_P=\frac{0-0.08}{\sqrt{0.08(0.92)}}=-0.2949. $$ The two possible values are quite unequal in magnitude. That asymmetry is a consequence of the binary outcome and the low fitted event probability, not by itself evidence of a calculation error.
Worked Example: A Grouped-Binomial Observation
Suppose, hypothetically, that \(y=3\) successes are observed in \(m=5\) trials, with fitted conditional success probability \(\hat p=0.40\). The fitted mean number of successes is \(m\hat p=5(0.40)=2\), and the fitted variance is $$ m\hat p(1-\hat p)=5(0.40)(0.60)=1.2. $$ The response residual is \(3-2=1\), and the Pearson residual is $$ r_P=\frac{3-5(0.40)}{\sqrt{5(0.40)(0.60)}} =\frac{1}{\sqrt{1.2}} =\frac{1}{1.095}=0.9129. $$
The observation is one success above its fitted mean, or about 0.913 fitted standard deviations above it. This calculation assumes that the five trials share the stated fitted probability and that the binomial variance is appropriate. If the trials do not have a common probability or the conditional variation is not binomial, this formula is not justified without changing the model.
Worked Example: A Sparse Poisson Count
Suppose a hypothetical count has fitted conditional Poisson mean \(\hat\mu=0.50\), and the observed count is \(y=2\). Under a Poisson model, the fitted variance is also \(0.50\). Thus $$ r_P=\frac{2-0.50}{\sqrt{0.50}} =\frac{1.50}{0.7071} =2.121. $$
The count is above its fitted mean by 1.50 events, which corresponds to a Pearson residual of 2.121 on the fitted Poisson standard-deviation scale. This conditional variance calculation is appropriate only if a Poisson variance is suitable for the outcome at the specified random-effect value. A large residual can flag an observation for investigation, but it does not alone establish why the count was surprising.
Raw, Variance-Scaled, and Leverage-Adjusted Residuals
The term “standardized residual” is used in more than one way. To avoid ambiguity, distinguish the following quantities.
| Quantity | Definition or description | What the scaling accounts for |
|---|---|---|
| Response residual | \(y_{ij}-\hat{\mu}_{ij}\) | No variance scaling |
| Variance-scaled Pearson residual | Response residual divided by the fitted response standard deviation | Different model-implied outcome variances |
| Leverage-adjusted residual | A Pearson residual further adjusted for the influence of fitting | An approximation to the reduction in residual variance caused by estimating the model |
Thus, a Pearson residual is already scaled by the fitted response variance. Some sources call it a standardized Pearson residual; others reserve “standardized” for a further adjustment. Always state which definition is being used.
In a simple GLM, a commonly used approximate leverage adjustment is \(r_{P,i}/\sqrt{1-h_{ii}}\), where \(h_{ii}\) is the \(i\)th diagonal element of an appropriate hat matrix. It attempts to account for the fact that fitted values are estimated from the same data, which can make ordinary fitted residuals less variable than residuals computed with known parameters. In a GLMM, the analogue depends on how the random effects and covariance parameters are estimated and on the fitting approximation. There is no single leverage adjustment that applies unchanged to every GLMM. Use such a correction only when its definition and approximation match the fitting method.
Worked Example: An Illustrative Leverage Adjustment
Suppose a fitted model gives a variance-scaled Pearson residual of \(r_P=2.00\) and, under a specified approximate adjustment, \(h_{ii}=0.20\). The adjusted residual is $$ \frac{r_P}{\sqrt{1-h_{ii}}} = \frac{2.00}{\sqrt{0.80}} = \frac{2.00}{0.8944} =2.236. $$
The adjustment increases the magnitude because \(0<\sqrt{1-h_{ii}}<1\). This arithmetic illustrates the adjustment; it does not imply that \(h_{ii}=0.20\) or this formula is valid for every GLMM. The model and estimation procedure must supply a defensible leverage quantity before interpreting an adjusted residual.
Why Discreteness Changes the Apparent Spread
If the parameters and random effects were known and the conditional model were correct, a Pearson residual would have conditional mean zero and variance one: $$ E\left[\frac{Y_{ij}-\mu_{ij}(b)} {\sqrt{\operatorname{Var}(Y_{ij}\mid b)}}\middle|b\right]=0, \qquad \operatorname{Var}\left[\frac{Y_{ij}-\mu_{ij}(b)} {\sqrt{\operatorname{Var}(Y_{ij}\mid b)}}\middle|b\right]=1. $$ This follows by subtracting the conditional mean and dividing by the conditional standard deviation. It does not imply that each residual is normally distributed, nor that the residuals computed after fitting are independent with exactly unit variance.
For a Bernoulli observation, only two residual values are possible at a given fitted probability: $$ r_P(1)=\sqrt{\frac{1-p}{p}}, \qquad r_P(0)=-\sqrt{\frac{p}{1-p}}. $$ When \(p\) is small, the positive value can be large, while the much more common zero outcome has a small negative residual. The residual distribution is therefore discrete and asymmetric even though its theoretical mean is zero and variance is one. For sparse Poisson counts, possible residual values are also discrete; with fitted mean \(\mu\), the smallest possible value is \(-\sqrt{\mu}\), attained at zero, while positive values increase in steps of \(1/\sqrt{\mu}\).
These features matter in practice. A histogram of binary Pearson residuals cannot become a smooth bell-shaped distribution merely because the sample is large: many observations can share one of a small number of values, especially when fitted probabilities are similar. In sparse counts, a few uncommon large positive residuals can coexist with many small negative residuals. Visual departure from normality is not, on its own, proof that the fitted mean or variance model is wrong.
Choosing the Scale and Reading Diagnostics
A conditional Pearson residual uses the conditional mean and response variance at fitted random effects. It asks whether an observation is surprising relative to the fitted response distribution at that random-effect value. A marginal residual instead uses a mean averaged over random effects and a variance that includes both response variation and variation in the conditional mean. By the law of total variance, $$ \operatorname{Var}(Y_{ij}) = E_b\{\operatorname{Var}(Y_{ij}\mid b)\} + \operatorname{Var}_b\{E(Y_{ij}\mid b)\}. $$ Consequently, a marginal Pearson residual is not obtained by simply reusing the conditional denominator with a marginal mean. The mean and variance must both refer to the same target distribution. These scales answer different questions; neither is universally preferable.
Fitted conditional residuals also use estimated fixed effects, variance parameters, and random effects. The theoretical mean-zero, variance-one result assumes the relevant parameters and conditioning values are known. Estimation, shrinkage of fitted random effects, and dependence among observations within clusters can alter the residuals’ distribution. Therefore, do not treat a collection of fitted Pearson residuals as independent standard normal observations without a specific justification.
When using Pearson residuals diagnostically, check that each residual was calculated on the intended response scale, with the correct denominator and conditioning convention. Look for repeated large values, systematic signs, or patterns against fitted means or covariates, while remembering that discreteness itself creates visible bands and asymmetry. An isolated large residual is a prompt to check the observation, model specification, and data processing; it is not a stand-alone model-selection rule.
The raw response residual remains useful because it is in the outcome’s original units: events, successes, or counts. Pearson scaling makes residual magnitudes more comparable across observations with different fitted variances. The scaling does not remove discreteness, account automatically for leverage, or repair a misspecified conditional variance. These distinctions are especially important for sparse outcomes, where a visually dramatic Pearson residual may arise from a rare but model-possible observation.
Check Your Understanding
Answer each question using the stated model and scale. Brief solutions follow the questions.
- A Bernoulli observation has fitted probability \(0.25\) and observed value \(1\). Calculate its Pearson residual.
- For a grouped-binomial observation, \(m=8\), \(y=2\), and \(\hat p=0.25\). Find the fitted mean, fitted variance, and Pearson residual.
- A Poisson observation has fitted mean \(4\) and observed count \(1\). Calculate its response residual and Pearson residual.
- Why can a correctly specified Bernoulli GLMM produce an asymmetric set of Pearson residuals?
- Why is it generally wrong to divide a marginal response residual by a conditional standard deviation without further justification?
Solutions. (1) \(r_P=(1-0.25)/\sqrt{0.25(0.75)}=0.75/\sqrt{0.1875}=1.732\). (2) The mean is \(8(0.25)=2\); the variance is \(8(0.25)(0.75)=1.5\); \(r_P=(2-2)/\sqrt{1.5}=0\). (3) The response residual is \(1-4=-3\), and \(r_P=-3/\sqrt{4}=-1.500\). (4) At a fixed probability \(p\), the residual has only two possible values, \(\sqrt{(1-p)/p}\) and \(-\sqrt{p/(1-p)}\); these need not have equal magnitude, so their distribution can be asymmetric. (5) The numerator and denominator would describe different distributions: marginal variation includes variation in the conditional mean across random effects, so the marginal mean must be paired with a variance on the marginal scale.