Why Residual Deviance Is Useful
A fitted binomial or Poisson GLM supplies a mean for each response unit. Deviance measures how much worse the fitted model explains the observed responses than a saturated model, which assigns a separate mean to each unit. Adding the units’ contributions gives the residual deviance, a single summary of the discrepancy left after fitting.
For binomial and Poisson models, unusually large residual deviance compared with its residual degrees of freedom can signal extra variation, but it can also signal that the mean structure or distributional assumptions are inadequate. The comparison is a diagnostic, not a stand-alone proof of overdispersion.
Deviance Contributions and Residual Deviance
Suppose there are \(n\) independent response units. Write \(y_i\) for the observed response and \(\hat\mu_i\) for its fitted mean. The saturated model is the model that fits each response unit as closely as possible by assigning it its own mean. The deviance is twice the log-likelihood difference between that saturated fit and the fitted model.
For a binomial response, let \(y_i\) be the number of successes in \(m_i\) trials and let \(\hat p_i=\hat\mu_i/m_i\) be the fitted success probability. The fitted success and failure means are \(m_i\hat p_i\) and \(m_i(1-\hat p_i)\). For a Poisson response, \(\hat\mu_i\) is the fitted count mean; it may incorporate an exposure through an offset. The resulting standard contributions are:
In these expressions, a term of the form \(0\log(0/a)\) is defined to be zero for \(a>0\). This convention covers observed zeros and, for binomial data, observed all-success or all-failure groups. The ordinary formulas assume fitted probabilities strictly between zero and one for binomial data, and positive fitted means for Poisson data. Boundary cases are handled by limits when the likelihood is well-defined.
Why These Formulas Are Deviance Contributions
The formulas follow directly by comparing each response’s fitted likelihood with its saturated likelihood. The likelihood terms that do not depend on the fitted mean cancel in the comparison.
Each contribution is nonnegative. One way to see this is that the saturated model maximizes the likelihood for that response unit over its possible mean or probability, so its log-likelihood cannot be smaller than the fitted log-likelihood. More explicitly, when all relevant means are positive, the Poisson contribution is \(2\hat\mu_i[x\log x-x+1]\), where \(x=y_i/\hat\mu_i\). The function \(x\log x-x+1\) is nonnegative for \(x\geq 0\), with its continuous value at zero equal to 1. For binomial data, nonnegativity follows from the corresponding likelihood maximization over \(p_i\in[0,1]\). Thus the deviance residual is real-valued, and a small \(d_i\) means that unit \(i\) is close to its saturated fit.
Worked Examples
Worked Example: A Poisson Contribution and Its Residual
A Poisson GLM gives a fitted mean of \(\hat\mu=2\) for an observed count \(y=0\). Calculate the deviance contribution and signed deviance residual.
For \(y=0\), the logarithmic term is zero by convention. Therefore,
The observed count is below its fitted mean, so the residual is negative:
The contribution to residual deviance is \(r_D^2=4\). The sign tells us the direction of the discrepancy; squaring the residual gives the contribution to \(D\).
Worked Example: A Grouped-Binomial Contribution
In one group, 8 of 10 trials are successes. A fitted binomial model gives \(\hat p=0.5\). Find the group’s deviance contribution and signed deviance residual.
The fitted means are 5 successes and 5 failures. Substituting \(y=8\), \(m-y=2\), and \(\hat p=0.5\) gives
Since \(8-10(0.5)=3>0\), the signed residual is positive:
The group’s contribution to the total residual deviance is about 3.855. It is not the raw difference \(8-5\); the likelihood comparison accounts for the binomial response scale.
Worked Example: Adding Contributions to Obtain Residual Deviance
Suppose a fitted model has three response units. The first is a Poisson count \(y_1=0\) with \(\hat\mu_1=0.36\), giving \(d_1=2(0.36)=0.72\). The other two units have binomial deviance contributions evaluated from their fitted likelihoods as
The first contribution is \(d_1=0.72\), so the total is
Each unit contributes a nonnegative amount, and the total is their sum. In practice, software calculates the contributions from the fitted model; checking individual contributions and their sum can help identify calculation or data-entry errors.
Using Residual Deviance as a Diagnostic
For a standard GLM with \(p\) estimated regression coefficients and a full-rank design matrix, the residual degrees of freedom are \(n-p\), where \(n\) counts independent response units. With a rank-deficient design, replace \(p\) by the design matrix rank. In grouped-binomial data, a response unit is a group, not each individual trial; the number of trials affects its contribution but does not turn the group into multiple independent rows.
When the binomial or Poisson model is correctly specified, the observations are independent, the parameters are identifiable and away from boundaries, and sample sizes are sufficiently large for the likelihood approximation to be reliable, residual deviance is often compared with a chi-square reference having approximately \(n-p\) degrees of freedom. This is an asymptotic benchmark, not an exact distributional identity for every fitted GLM. Sparse counts, small binomial denominators, or boundary estimates can make the approximation poor.
A residual deviance that is unusually large relative to this benchmark means the fitted model leaves more discrepancy than would ordinarily be expected under the assumed model. That is consistent with extra variation, but it is not specific to it. A wrong mean structure, dependence between responses, influential observations, or a poorly chosen response distribution can also inflate the deviance. The size of \(D\) should therefore prompt investigation of the model and data rather than an automatic change to the variance assumption.
Use the appropriate binomial or Poisson formula for each response unit, including the zero-term convention.
Compute \(D=\sum_i d_i\); equivalently, sum the squared signed deviance residuals.
Compare the residual deviance with its residual degrees of freedom, keeping the asymptotic assumptions and possible alternative sources of misfit in view.
Common Pitfall
- Wrong reasoning: “The residual deviance exceeds its residual degrees of freedom, so the data are definitely overdispersed.”
- Correction: A large value is a warning that observed responses depart more than expected under the fitted model. Overdispersion is one possible explanation; misspecified means, dependence, influential observations, sparse data, and family mismatch can produce a similar signal. Examine those possibilities before interpreting the discrepancy as extra variation.
- Another error: Treating \(D\) as a signed quantity. Individual residuals have signs, but each contribution is their square and the total deviance is nonnegative.
Check Your Understanding
Answer each question using the definitions and conditions above.
- For a Poisson observation with \(y=0\) and \(\hat\mu=1.5\), calculate its deviance contribution.
- Why is the deviance contribution nonnegative, and what does a contribution of zero indicate?
- For grouped-binomial data, what does \(n\) count when calculating residual degrees of freedom?
- What does the sign of a signed deviance residual tell you, and what does its square contribute?
- Name two explanations other than overdispersion for an unusually large residual deviance.