Tutorials › Exam SRM - Statistics for Risk Modeling › Detecting Overdispersion With Residual Statistics

Exam SRM · Deviance and GLM Diagnostics · Tutorial 369 of 926

Detecting Overdispersion With Residual Statistics

Use Pearson residuals and residual degrees of freedom to assess whether a fitted GLM shows evidence of overdispersion.

Advanced 11 min read

What You'll Learn

  • Define overdispersion relative to a GLM’s specified variance function
  • Calculate Pearson residuals and the Pearson chi-square statistic
  • Find residual degrees of freedom and the Pearson dispersion ratio
  • Interpret the ratio without treating it as a definitive diagnosis
  • Recognize why using the number of observations instead of residual degrees of freedom is a trap

Why Check Residual Variation?

A generalized linear model (GLM) specifies both a relationship for the mean response and a variance for responses around that mean. A model can describe the average count reasonably well while still understating how much individual counts vary. Comparing residual variation with the variance specified by the fitted model provides a diagnostic for this mismatch.

This tutorial focuses on the Pearson chi-square statistic and its comparison with residual degrees of freedom. The comparison is a diagnostic signal, not proof of a particular cause. It also does not replace inspection of residual patterns: a large aggregate statistic can flag excess variation without identifying where it comes from.

Definition: A GLM shows overdispersion relative to its assumed variance function when the conditional response variation is greater than that function predicts. For example, a Poisson GLM assumes \(\operatorname{Var}(Y_i\mid x_i)=\mu_i\), where \(\mu_i=E[Y_i\mid x_i]\). Overdispersion relative to that assumption means the responses vary more than their fitted Poisson means alone allow.

The key phrase is “relative to its assumed variance.” A large count is not, by itself, evidence of overdispersion. Its Pearson residual compares the observation with its fitted mean and scales the difference by the fitted standard deviation. The statistic then aggregates the squared scaled residuals.

Pearson Residuals and the Dispersion Ratio

For independent observations in a GLM, let \(y_i\) be the observed response, \(\hat{\mu}_i\) its fitted mean, and \(V(\hat{\mu}_i)\) the variance function evaluated at that mean. The variance function describes the response variance under the model, apart from any separate dispersion multiplier. In a Poisson GLM, \(V(\hat{\mu}_i)=\hat{\mu}_i\).

Definition: The Pearson residual for observation \(i\) is the observed-minus-fitted response divided by the model-based standard deviation. The Pearson chi-square statistic is the sum of squared Pearson residuals. If \(n\) independent observations are used to estimate \(p\) regression coefficients, the residual degrees of freedom are \(n-p\), and the Pearson dispersion ratio is the Pearson chi-square statistic divided by those residual degrees of freedom.
$$ r_{P,i}=\frac{y_i-\hat{\mu}_i}{\sqrt{V(\hat{\mu}_i)}}, \qquad X_P^2=\sum_{i=1}^{n}r_{P,i}^2 =\sum_{i=1}^{n}\frac{(y_i-\hat{\mu}_i)^2}{V(\hat{\mu}_i)}, \qquad \widehat{\phi}_{P}=\frac{X_P^2}{n-p}. $$

For a Poisson GLM with its usual variance assumption, the dispersion is fixed at \(\phi=1\). Thus, a Pearson dispersion ratio materially greater than 1 is a signal that the residual variation may exceed the Poisson variance. For a model whose variance is written \(\phi V(\mu_i)\), the ratio is commonly used as an estimate of the dispersion multiplier \(\phi\). The ratio is not a universal pass-or-fail cutoff; its interpretation depends on the model, sample size, and other diagnostic evidence.

The residual degrees of freedom account for fitting the regression coefficients. In the usual unweighted setting, \(p\) counts all estimated regression coefficients, including an intercept. A fixed offset is not an estimated coefficient and does not add to \(p\).

Why the Comparison Uses Residual Degrees of Freedom

Under a correctly specified Poisson model with fixed means, each Pearson residual has expected square 1: its numerator is a response deviation with variance \(\mu_i\), and its denominator is \(\sqrt{\mu_i}\). This gives an expected Pearson statistic of \(n\) before parameters are estimated. Estimating the model parameters uses information from the same responses to fit the means, so the residuals have fewer freely varying directions. Under regularity conditions, this leads to the familiar approximate chi-square reference with \(n-p\) residual degrees of freedom.

The following justification makes the degrees-of-freedom adjustment explicit in the simpler normal linear-model case. With independent normal errors of common variance \(\sigma^2\), the fitted residual vector is obtained by projecting the error vector onto the residual space. That space has dimension \(n-p\). The sum of squared residuals divided by \(\sigma^2\) therefore has a chi-square distribution with \(n-p\) degrees of freedom, and its expected value is \(n-p\). GLM Pearson statistics use the same residual-variation logic, but their chi-square calibration is generally approximate rather than an exact finite-sample result.

$$ E(X_P^2)\ \text{is approximately}\ n-p, \qquad \widehat{\phi}_{P}=\frac{X_P^2}{n-p}\ \text{is approximately}\ 1 \quad\text{under the assumed dispersion.} $$

This approximation should not be read as a promise that every correctly specified data set will have a ratio near exactly 1. Random fluctuation matters, especially with few residual degrees of freedom. Small expected counts can also make a chi-square approximation less dependable. Treat the ratio as diagnostic evidence and consider it alongside the residual plots and model assumptions.

Worked Example: An Intercept-Only Poisson Model

A hypothetical insurer counts a particular type of service claim for six otherwise comparable policy groups. Suppose an intercept-only Poisson GLM is fitted to counts \(0,0,0,6,6,6\). Calculate the fitted mean, Pearson statistic, residual degrees of freedom, and dispersion ratio. Assess whether the residual statistic suggests excess variation relative to the Poisson assumption.

Method. For an intercept-only Poisson model, the fitted mean is the sample mean. There is one estimated coefficient, so \(p=1\).

Fit the mean. The total count is \(0+0+0+6+6+6=18\). Therefore, \(\hat{\mu}=18/6=3\). Under the Poisson model, the variance used for each observation is also 3.

Calculate the contributions. Each zero contributes \((0-3)^2/3=9/3=3\). Each six contributes \((6-3)^2/3=9/3=3\). There are three of each, so \(X_P^2=3(3)+3(3)=18\).

Adjust for fitted parameters. The residual degrees of freedom are \(6-1=5\). Thus, \(\widehat{\phi}_{P}=18/5=3.6\).

The ratio is substantially above 1, so these counts show a strong Pearson-statistic signal of more variation than the fitted Poisson variance predicts. This is a diagnostic conclusion, not a determination of why the variation is high. The calculation avoids treating a Poisson variance as something estimated separately from the fitted mean.

Check. The fitted mean is 3, and the average squared Pearson residual is \(18/6=3\). Dividing the total by the five residual degrees of freedom gives \(3.6\), as calculated.

Worked Examples: Reading the Statistic in Context

Worked Example: Exposure Offset and Residual Degrees of Freedom

A hypothetical monitoring program records event counts over five exposure amounts, measured in consistent units. A Poisson model has a log-exposure offset and an estimated common event rate. The exposures are \(1,2,3,4,5\), the observed counts are \(0,1,6,2,6\), and the fitted means are \(1,2,3,4,5\). Calculate the Pearson dispersion ratio and interpret it.

Method. For a Poisson response, \(V(\hat{\mu}_i)=\hat{\mu}_i\). The model estimates one rate coefficient; the fixed offset is not an estimated coefficient. Thus, \(n=5\), \(p=1\), and the residual degrees of freedom are 4.

Calculate each contribution. In observation order, the terms are \((0-1)^2/1=1\), \((1-2)^2/2=1/2\), \((6-3)^2/3=9/3=3\), \((2-4)^2/4=4/4=1\), and \((6-5)^2/5=1/5\).

Sum and divide. The Pearson statistic is \(1+0.5+3+1+0.2=5.7\). Therefore, \(\widehat{\phi}_{P}=5.7/4=1.425\).

The ratio is above 1, so it indicates some excess-variation signal relative to the Poisson variance, but it is not by itself a definitive diagnosis. The third observation contributes 3 of the total 5.7, so it is particularly important not to overlook its role in this aggregate statistic. This calculation avoids incorrectly counting the fixed exposure offset as an estimated coefficient.

Check. The five contributions sum to 5.7, and \(n-p=5-1=4\); hence \(5.7/4=1.425\).

Worked Example: A Ratio Below One Is Not Evidence of Overdispersion

A hypothetical call center records counts \(1,1,2,2,3,3,4,4\) in eight comparable time blocks. An intercept-only Poisson model is fitted. Calculate the Pearson statistic and dispersion ratio, and state what the result does and does not establish.

Fit the mean. The counts sum to \(20\), so the fitted mean is \(20/8=2.5\). The Poisson variance for each block is therefore 2.5. There is one estimated coefficient, giving \(8-1=7\) residual degrees of freedom.

Calculate the contributions. Each count of 1 contributes \((1-2.5)^2/2.5=2.25/2.5=0.9\), for \(2(0.9)=1.8\). Each count of 2 contributes \(0.25/2.5=0.1\), for \(0.2\). Counts of 3 contribute another \(0.2\), and counts of 4 contribute another \(1.8\). Therefore, \(X_P^2=1.8+0.2+0.2+1.8=4.0\).

Calculate and interpret the ratio. The ratio is \(4/7\approx0.5714\), rounded to four decimal places. It does not indicate excess variation relative to the Poisson assumption in this sample. A ratio below 1 does not establish that the model is correct; it may reflect ordinary sampling variation, and other aspects of the fit still require consideration. This interpretation avoids treating every departure from 1 as overdispersion.

Check. The contributions total 4.0, and dividing by 7 residual degrees of freedom gives \(0.5714\) to four decimal places.

Common Exam Trap: Dividing by the Number of Observations

A frequent error is to divide \(X_P^2\) by \(n\) rather than by \(n-p\). The raw statistic sums \(n\) squared residuals, but the fitted model has used the data to estimate its coefficients. The residual degrees of freedom reflect that fitting.

For the first example, the incorrect calculation would be \(18/6=3\). The correct calculation is \(18/(6-1)=3.6\), because the intercept was estimated. The incorrect denominator makes the ratio too small and can weaken the apparent overdispersion signal.

Another important distinction is that Pearson chi-square and residual deviance are different statistics. Both can contribute to GLM fit assessment, but the Pearson statistic specifically sums squared observed-minus-fitted differences divided by the fitted variance function. Do not substitute residual deviance into the Pearson-ratio formula.

Key takeaway: Calculate Pearson residuals using the variance specified by the fitted GLM, sum their squares, and compare that sum with residual degrees of freedom. A ratio materially above 1 is evidence to investigate excess residual variation; it is not, alone, proof of its cause or a complete assessment of model fit.

Check Your Understanding

For each problem, calculate the Pearson statistic and divide by the correct residual degrees of freedom. Use the stated Poisson variance and interpret the result relative to 1.

  1. An intercept-only Poisson model is fitted to four counts \(0,2,2,4\). Find the fitted mean, Pearson statistic, residual degrees of freedom, and dispersion ratio. (Answer: fitted mean \(2\), \(X_P^2=4\), \(df=3\), ratio \(1.3333\); a modest excess-variation signal.)
  2. An intercept-only Poisson model is fitted to six counts \(1,1,2,2,4,8\). Calculate the four requested quantities and identify whether the ratio signals excess variation. (Answer: fitted mean \(3\), \(X_P^2=12\), \(df=5\), ratio \(2.4\); excess-variation signal.)
  3. A Poisson regression with two estimated coefficients gives fitted means \(1,2,2,4,4\) for observed counts \(0,2,1,8,4\). Calculate each Pearson contribution, the total statistic, and the ratio. (Answer: contributions \(1,0,0.5,4,0\); \(X_P^2=5.5\), \(df=3\), ratio \(1.8333\); excess-variation signal.)
  4. An intercept-only Poisson model is fitted to eight counts \(1,1,2,2,3,3,4,4\). Explain why the denominator is not 8, then calculate the ratio. (Answer: one coefficient is estimated, so \(df=8-1=7\); \(X_P^2=4\); ratio \(4/7=0.5714\), with no excess-variation signal.)
  5. A Poisson model with two estimated coefficients has fitted means \(1,2,3,4\) and observed counts \(0,2,9,1\). Calculate the contribution from each observation and the Pearson ratio. Which observation contributes most? (Answer: contributions \(1,0,12,2.25\); \(X_P^2=15.25\), \(df=2\), ratio \(7.625\); the third observation contributes most.)
Clinical Biostats