Why Use Deviance to Estimate Dispersion?
In a quasi-binomial or quasi-Poisson model, the conditional variance is allowed to be a dispersion parameter \(\phi\) times a specified variance function. A common estimate of \(\phi\) uses the Pearson statistic divided by residual degrees of freedom. Another option uses the model's residual deviance in the same way. The two estimates often tell a similar story, but their numerators measure lack of fit differently, so they need not agree.
This tutorial defines the deviance-based estimate, works through both count and grouped-binomial examples, and explains why deviance and Pearson residuals are closely related when fitted residuals are small. In quasi-likelihood, deviance is a useful measure derived from the variance function; it should not be mistaken for a likelihood-ratio test.
Residual Deviance and Its Scale Estimate
For grouped binomial data, a row is a group of trials and its unit deviance uses that group's success count and trial total. Thus \(n\) counts the modeled rows, not the individual Bernoulli trials within those rows. A saturated fit has zero residual deviance; if \(\nu=0\), the ratio defining \(\hat{\phi}_D\) is unavailable.
For the Poisson and grouped-binomial variance functions, the unit deviances are as follows. When a count is zero, the convention \(0\log 0=0\) is understood; endpoint terms in the binomial expression are interpreted by continuity.
In the binomial expression, \(y\) is the number of successes, \(m\) is the number of trials, and \(\mu=mp\) is the fitted mean number of successes. These formulas also arise as ordinary likelihood deviances for the corresponding binomial and Poisson models. In a quasi-likelihood analysis, however, a scaled deviance is not automatically a likelihood-ratio test.
Deriving the Unit Deviance and Its Local Approximation
For these variance functions, the unit deviance has an integral representation. This representation explains both its nonnegativity and its relationship to the Pearson statistic. For a Poisson observation, let \(V(\mu)=\mu\); for a binomial count with \(m\) trials, let \(V(\mu)=\mu(1-\mu/m)\). In either case, for an interior mean and an observed value in the allowable range, define
The integral is nonnegative whether \(y\) is above or below \(\mu\): when \(y<\mu\), both the direction of integration and the sign of \(y-t\) reverse. To verify that this gives the stated formulas, differentiate with respect to \(y\). For Poisson, the derivative of half the integral representation is \(\int_\mu^y dt/t=\log(y/\mu)\). For binomial, \(\int_\mu^y dt/[t(1-t/m)] = \log(y/\mu)-\log((m-y)/(m-\mu))\). These are the derivatives with respect to \(y\) of the respective half-deviances. Both expressions vanish at \(y=\mu\), so integration establishes the formulas, including endpoints by continuity. This proves the integral representation. \(\square\)
The representation also gives a precise local comparison with Pearson's statistic. If \(V\) is positive and continuously differentiable on an interval containing \(y\) and \(\mu\), and \(1/V\) has derivative bounded in absolute value by \(M\) there, then
To prove this bound, write \(g(t)=1/V(t)\) and \(\delta=y-\mu\). The mean value theorem gives \(|g(t)-g(\mu)|\leq M|t-\mu|\). Subtracting \(2g(\mu)\int_\mu^y(y-t)\,dt=g(\mu)\delta^2\) from the integral for \(d\), and taking absolute values, bounds the difference by
Thus deviance agrees with the Pearson squared residual to second order when the residual is small relative to the local scale of the variance function. This is a local approximation, not an identity for arbitrary observations.
Worked Examples
Worked Example: Poisson Intercept-Only Fit
Suppose four independent Poisson counts are \(1,2,3,6\), and an intercept-only model is fitted. Its common fitted mean is the sample mean: \(\hat{\mu}=(1+2+3+6)/4=3\). There is one fitted coefficient, so \(\nu=4-1=3\).
The individual Poisson deviance contributions are
Adding them gives \(D_{\mathrm{res}}\approx4.498682\), and therefore \(\hat{\phi}_D=4.498682/3\approx1.499561\). For comparison, the Pearson statistic is
Both estimates are above one, but they are not equal: the largest count's deviance contribution is \(2.317766\), whereas its Pearson contribution is \(9/3=3\). Deviance and Pearson residuals weight departures differently away from the fitted mean.
Worked Example: Grouped Binomial Model With a Common Success Probability
Two groups each have \(m=10\) trials, with observed success counts \(2\) and \(8\). Fit a common success probability. The estimated probability is \(\hat{p}=(2+8)/20=0.5\), so each fitted success count is \(\hat{\mu}=10(0.5)=5\). There are two rows and one fitted coefficient, hence \(\nu=1\).
For the first group, the deviance contribution is
The second group gives the same contribution, with successes and failures interchanged. Therefore \(D_{\mathrm{res}}\approx7.709790\) and \(\hat{\phi}_D=7.709790/1\approx7.709790\). For the Pearson calculation, each group has fitted variance \(m\hat{p}(1-\hat{p})=10(0.5)(0.5)=2.5\). Each observed count differs from its fitted count by \(3\), so
The estimates differ even though the example is symmetric. The deviance-based estimate is about \(7.709790\), while the Pearson-based estimate is \(7.2\); the difference reflects the distinct measures of residual size, not a different fitted probability.
Worked Example: A Zero Count in a Poisson Fit
Consider counts \(0,2,4\) in an intercept-only Poisson model. The fitted mean is \(\hat{\mu}=(0+2+4)/3=2\), and the residual degrees of freedom are \(3-1=2\). For the zero count, use the convention \(0\log(0/2)=0\):
For the other observations,
Consequently, \(D_{\mathrm{res}}\approx4+0+1.545177=5.545177\), giving \(\hat{\phi}_D=5.545177/2\approx2.772589\). The Pearson statistic and its estimate are
The zero observation contributes \(4\) to the deviance and \(2\) to the Pearson statistic. The zero-count convention makes the deviance finite and straightforward to calculate; it does not make the two residual measures interchangeable.
How to Interpret the Estimate
The ratio \(\hat{\phi}_D=D_{\mathrm{res}}/\nu\) is used as a scale estimate because, in a well-fitting model, residual deviance is often on the order of the residual degrees of freedom when the scale is near one. If the variance is inflated by \(\phi\), this motivates looking for residual deviance on the order of \(\phi\nu\). The local approximation above explains why that reasoning resembles the Pearson-based approach when individual residuals are modest.
It does not imply that \(D_{\mathrm{res}}/\nu\) is exactly unbiased for \(\phi\), or that it must equal the Pearson estimate in a finite sample. The fitted means are estimated, the deviance is not generally a sum of independent squared standard normal variables, and larger residuals make the higher-order differences relevant. A substantial discrepancy between \(\hat{\phi}_D\) and \(\hat{\phi}_P\) is a reason to inspect the fitted values and residual contributions, not a reason to choose whichever estimate is more convenient.
The two estimates share the same denominator when the same fit and residual degrees of freedom are used. Their comparison is therefore especially transparent: it is the difference between the residual deviance and Pearson statistic that drives the difference in the scale estimates. The deviance-based estimate is a practical alternative, not a replacement for checking whether the mean and variance structure are scientifically sensible.
Common Mistakes
- Calling deviance divided by degrees of freedom an exact identity. It is an estimate motivated by residual behavior, not a theorem that the ratio equals the true dispersion.
- Using the number of individual trials for grouped data's residual degrees of freedom. In grouped-binomial GLMs, count the fitted rows and subtract the number of fitted regression coefficients under the usual full-rank setup.
- Substituting the Pearson statistic for deviance. They are related locally, but their contributions differ for finite residuals; calculate the requested statistic from its own formula.
- Treating a quasi-model's scaled deviance as a likelihood-ratio test. A quasi-likelihood model does not in general provide a full probability likelihood from which that interpretation follows.
Check Your Understanding
Use the definitions and examples above to answer these questions.
- For a grouped-binomial model with four rows and two fitted regression coefficients, what residual degrees of freedom are used under the usual full-rank setup?
- Why does a zero observed Poisson count have a finite deviance contribution?
- In what sense are a unit deviance and the corresponding Pearson squared residual close when the fitted residual is small?
- For the counts \(0,2,4\) in the worked intercept-only example, state the deviance-based and Pearson-based dispersion estimates and explain why they differ.
- Why should a scaled deviance from a quasi-likelihood fit not automatically be called a likelihood-ratio test?