Tutorials › Generalized Linear Models › Estimated Dispersion in Goodness-of-Fit Assessment

Goodness of Fit and Calibration · Tutorial 787 of 981

Estimated Dispersion in Goodness-of-Fit Assessment

See how dispersion estimates alter Pearson fit statistics, when the adjustment is algebraically circular, and why it does not diagnose or correct mean-model misspecification.

Intermediate 12 min read

What You'll Learn

  • Define the dispersion parameter and Pearson statistic used in GLM fit assessment
  • Distinguish known-dispersion reference tests from plug-in adjustments
  • Derive the exact Gaussian residual-sum-of-squares result and its conditions
  • Calculate Pearson statistics and dispersion estimates in Gaussian, Poisson, and binomial examples
  • Recognize when scaling a statistic cannot provide independent evidence of fit
  • Separate excess variation from evidence of a wrong mean structure

Why Dispersion Changes a Fit Assessment

A Pearson goodness-of-fit statistic measures residual variation relative to what a model predicts. Its reference scale depends on the response variance. If that variance includes an unknown dispersion parameter, the same raw residual sum can look unusually large when dispersion is assumed to be one and unremarkable after the scale is estimated. The crucial question is whether that estimate supplies information independent of the statistic being assessed.

For a Gaussian model, estimating the variance from the residual sum of squares makes the scaled Pearson statistic equal the residual degrees of freedom exactly. This is an algebraic identity, not a goodness-of-fit finding. In other GLMs, a Pearson-based dispersion estimate has the same property when it is calculated from that same Pearson statistic. The adjustment can still help describe variability or calibrate standard errors, but by itself it does not give an independent test of absolute fit.

Dispersion and the Pearson Statistic

Definition: In a GLM with independent responses \(Y_1,\ldots,Y_n\), mean values \(\mu_i=E[Y_i]\), and variance function \(V\), a dispersion parameter \(\phi>0\) scales the response variances as \(\operatorname{Var}(Y_i)=\phi V(\mu_i)\). Given fitted means \(\hat{\mu}_i\), the Pearson statistic is $$ X_P^2=\sum_{i=1}^n \frac{(Y_i-\hat{\mu}_i)^2}{V(\hat{\mu}_i)}. $$ If the fitted mean model has \(p\) estimated coefficients, the usual residual degrees of freedom are \(\nu=n-p\), assuming \(n>p\) and a full-rank design. A known-dispersion reference statistic is \(X_P^2/\phi\).

This definition uses one independent response per observation. For grouped binomial data, each response is a count and the variance function includes the number of trials. For example, if \(Y_i\) is binomial with \(m_i\) trials and fitted success probability \(\hat q_i\), its Pearson contribution is \((Y_i-m_i\hat q_i)^2/[m_i\hat q_i(1-\hat q_i)]\).

For Poisson and ordinary binomial GLMs, the conventional sampling model fixes \(\phi=1\). A value of \(\phi\) other than one may be introduced in an extended or quasi-likelihood variance model to represent extra or reduced variability. For Gaussian GLMs, \(\phi\) is the error variance. For models where dispersion is estimated, a common Pearson method-of-moments estimate is

$$ \hat{\phi}_P=\frac{X_P^2}{\nu}. $$

This is a useful description of residual variation relative to the model’s variance function. But if the same \(X_P^2\) is then divided by \(\hat{\phi}_P\), the result cannot be treated as though the scale estimate had been obtained independently.

Exact Gaussian Result

The Gaussian linear model gives an exact illustration. Let \(Y=X\beta+\varepsilon\), where \(X\) is a fixed \(n\)-by-\(p\) matrix of rank \(p\), and \(\varepsilon\sim N(0,\phi I_n)\) for \(\phi>0\). Write \(\hat Y\) for the least-squares fitted vector and \(RSS=\sum_i(Y_i-\hat Y_i)^2\). In this model \(V(\mu)=1\), so \(X_P^2=RSS\).

Theorem: Under the Gaussian linear model just stated, for \(n\ge p\), $$ \frac{RSS}{\phi}\sim\chi^2_{n-p}, $$ where \(\chi^2_0\) means a distribution concentrated at zero. If \(n>p\), the estimator \(\hat{\phi}=RSS/(n-p)\) is defined. Whenever \(RSS>0\), \(RSS/\hat{\phi}=n-p\).

Proof. Let \(H=X(X^\mathsf{T}X)^{-1}X^\mathsf{T}\) be the projection onto the column space of \(X\), and let \(M=I-H\). The matrix \(M\) is symmetric and idempotent, and its rank is \(n-p\). Since \(X\beta\) lies in the column space of \(X\), the residual vector is \(M Y=M\varepsilon\), giving

$$ RSS=\varepsilon^\mathsf{T}M\varepsilon. $$

Set \(Z=\varepsilon/\sqrt{\phi}\); its entries are independent standard normal variables. The spectral theorem gives an orthogonal matrix \(Q\) for which \(Q^\mathsf{T}MQ\) is diagonal with \(n-p\) ones and \(p\) zeros. Because the standard multivariate normal distribution is unchanged by orthogonal transformations, \(Q^\mathsf{T}Z\) also has independent standard normal entries. Therefore

$$ \frac{RSS}{\phi} =Z^\mathsf{T}MZ =\sum_{j=1}^{n-p}(Q^\mathsf{T}Z)_j^2 \sim\chi^2_{n-p}. $$

When \(n=p\), the sum is empty and \(RSS=0\) identically, as the stated \(\chi^2_0\) convention requires; no variance estimate based on \(RSS/(n-p)\) is defined. When \(n>p\) and \(RSS>0\), substitution gives \(RSS/\hat{\phi}=RSS/[RSS/(n-p)]=n-p\). \(\square\)

Thus, even in the setting where a chi-square reference result is exact for known \(\phi\), estimating \(\phi\) from the same residual sum removes the variation in the scaled statistic. The result is fixed by construction, not evidence that the fitted means are correct.

Worked Example: Gaussian Fit With Estimated Variance

Suppose six observations follow a Gaussian linear model with an intercept and one slope, so \(n=6\), \(p=2\), and \(\nu=4\). Let the predictor values be \(0,1,2,3,4,5\), and the observed responses be \(11,10,15,17,16,21\). The fitted line is \(\hat y=10+2x\), giving residuals \(1,-2,1,1,-2,1\).

The residuals sum to zero, and their predictor-weighted sum is \(0(1)+1(-2)+2(1)+3(1)+4(-2)+5(1)=0\). They are therefore orthogonal to both the intercept and slope columns, confirming the stated least-squares fit. The residual sum of squares and estimated variance are

$$ RSS=1^2+(-2)^2+1^2+1^2+(-2)^2+1^2=12, \qquad \hat{\phi}=\frac{12}{4}=3. $$

The Pearson statistic is \(X_P^2=RSS=12\). Its estimated-dispersion adjustment is \(12/3=4\), exactly the residual degrees of freedom. If the variance had been known to equal \(3\) independently, the statistic \(12/3=4\) could instead be compared with a \(\chi^2_4\) reference distribution under the model assumptions. Here the value \(4\) comes from estimating the variance using this very \(RSS\), so it is not an independent fit check.

What Pearson-Based Dispersion Adjustment Does

The algebra behind the Gaussian example applies more broadly. It does not require normality; it follows directly from the definition of a Pearson-based dispersion estimate.

Result: If \(\nu>0\), \(X_P^2>0\), and \(\hat{\phi}_P=X_P^2/\nu\), then $$ \frac{X_P^2}{\hat{\phi}_P}=\nu. $$ This equality holds identically for the observed data; it is not a chi-square approximation or a test result.

Derivation. Since \(\nu>0\) and \(X_P^2>0\), the defined estimate \(\hat{\phi}_P=X_P^2/\nu\) is positive. Direct substitution gives \(X_P^2/\hat{\phi}_P=X_P^2/(X_P^2/\nu)=\nu\). If \(X_P^2=0\), then this estimate is zero and the ratio is undefined; one must not claim the equality in that case. \(\square\)

This identity explains why a Pearson statistic scaled by its own Pearson dispersion estimate cannot be read as an ordinary absolute-fit test with a chi-square reference distribution. If an estimate of dispersion comes from another source, or from a different statistic, the adjusted Pearson statistic need not equal \(\nu\). But its reference distribution then depends on how that scale was estimated; one cannot simply assume that treating the estimate as fixed yields a valid test.

Worked Example: Poisson Counts and a Pearson Scale Estimate

Consider four independent Poisson counts \(Y_i\) with a common fitted mean \(\hat{\mu}=5\). The observed counts are \(2,4,6,8\). The fitted common mean is their average, \((2+4+6+8)/4=5\), and one mean parameter has been estimated, leaving \(\nu=4-1=3\).

For a Poisson model, \(V(\mu)=\mu\). The Pearson statistic is

$$ X_P^2=\frac{(2-5)^2}{5}+\frac{(4-5)^2}{5} +\frac{(6-5)^2}{5}+\frac{(8-5)^2}{5} =\frac{9+1+1+9}{5}=4. $$

The conventional Poisson model fixes \(\phi=1\). If instead a Pearson-based scale estimate is used to describe extra variation, it is \(\hat{\phi}_P=4/3\). Rescaling this same Pearson statistic gives \(4/(4/3)=3\), exactly \(\nu\). This calculation does not establish that a Poisson mean model is adequate or that the data are overdispersed; it shows only that the chosen residual sum is \(4/3\) times its residual degrees of freedom.

Worked Example: Grouped Binomial Data

Suppose four independent groups each have \(m_i=10\) trials, and a common success probability \(q\) is fitted. The observed success counts are \(2,4,6,8\). The fitted probability is the pooled proportion, \(\hat q=(2+4+6+8)/(4\cdot10)=0.5\). There is one fitted parameter, so \(\nu=4-1=3\).

The fitted mean count in each group is \(10(0.5)=5\), and its binomial variance is \(10(0.5)(0.5)=2.5\). Thus the Pearson statistic is

$$ X_P^2=\frac{(2-5)^2+(4-5)^2+(6-5)^2+(8-5)^2}{2.5} =\frac{20}{2.5}=8. $$

The binomial sampling model fixes \(\phi=1\). A Pearson scale estimate would be \(8/3\), and adjusting \(X_P^2\) by that estimate gives \(8/(8/3)=3\). As in the Poisson calculation, this is an identity produced by using \(X_P^2\) to estimate the scale and then reusing it. It does not independently confirm the common-probability model.

Dispersion Is Not a Remedy for a Wrong Mean

Dispersion describes the scale of variation around the fitted means, relative to a specified variance function. It is not a parameter that changes those means. Multiplying a variance model by a common \(\phi\) can account for residuals being larger or smaller overall, but it does not alter their signs, their ordering across observations, or a pattern tied to a predictor.

In the Poisson example, the residuals in the stated order are \(-3,-1,1,3\). Their steady increase could be a warning if the counts correspond to an ordered predictor and a common-mean model ignores that ordering. Estimating \(\phi\) changes the scale assigned to these residuals; it does not remove the pattern. A missing predictor, an unsuitable link, omitted interactions, dependence, or an inadequate variance function can all require different investigation. Conversely, a large estimated dispersion does not by itself prove that the mean structure is wrong: genuine extra variation or dependence may be responsible.

For non-Gaussian models, \(X_P^2/\phi\) is often compared approximately with a chi-square distribution on residual degrees of freedom when the mean and variance specifications are adequate and the data provide a suitable large-sample approximation. This is not an exact general GLM result. Sparse data and too few informative groups can make the approximation unreliable, even when the formula is computed correctly. Where \(\phi=1\) is part of the specified sampling model, using a fitted \(\hat{\phi}\) instead is a change in the variance assumption, not merely a mechanical correction to a fixed-model goodness-of-fit test.

Common Mistakes

  • Treating a self-scaled statistic as independent evidence. If \(\hat{\phi}_P=X_P^2/\nu\), then \(X_P^2/\hat{\phi}_P=\nu\) whenever the ratio is defined. That equality cannot show that the mean model fits.
  • Applying a Gaussian identity outside its assumptions. The exact result \(RSS/\phi\sim\chi^2_{n-p}\) uses a Gaussian linear model with fixed design and constant variance. Pearson statistics in other GLMs generally rely on approximations.
  • Ignoring whether the variance estimate exists. The Gaussian estimate \(RSS/(n-p)\) requires \(n>p\). With \(n=p\), \(RSS=0\) and the denominator is zero.
  • Assuming scale adjustment fixes systematic residuals. A dispersion multiplier changes residual scale, not the fitted mean pattern. Inspect the residuals and model structure as well as any summary statistic.
  • Calling an estimated scale a test by itself. A scale estimate summarizes variation under a chosen variance structure. A goodness-of-fit conclusion requires a valid reference argument and attention to how the scale was estimated.
Key takeaway: With known dispersion, a Pearson statistic can have a useful reference distribution under suitable conditions. When dispersion is estimated from that same statistic, the adjusted value is fixed at the residual degrees of freedom. Treat the estimate as a description of scale, and assess mean structure and reference assumptions separately.

Check Your Understanding

Answer each question using the distinction between a variance-scale estimate and an independent fit assessment.

  1. Why does \(RSS/\hat{\phi}=n-p\) in a Gaussian linear model when \(\hat{\phi}=RSS/(n-p)\) and \(RSS>0\)?
  2. What happens to the Gaussian variance estimate when \(n=p\), and why is the usual ratio then unavailable?
  3. A GLM has \(\nu=8\) and \(X_P^2=12\). Find the Pearson-based dispersion estimate and the same-statistic adjusted value.
  4. Why does estimating dispersion not remove a systematic trend in residuals across a predictor?
  5. Name one reason a Pearson chi-square approximation may be unreliable even if the statistic and residual degrees of freedom have been calculated correctly.
Clinical Biostats