Why Break Deviance Into Cases?
A generalized linear model (GLM) summarizes how well its fitted response distribution represents the observations. The total residual deviance gives an overall measure of lack of fit, but it does not show which observations account for that total. Casewise contributions answer a more focused question: how much does each observation add to the model’s deviance?
This breakdown is useful when reviewing a fitted Poisson model for counts or a binomial model for successes and failures. A large contribution identifies an observation whose response is relatively poorly represented by its fitted mean or probability. It is a diagnostic clue, not by itself proof that the observation is erroneous or that the model is misspecified.
The comparison is made observation by observation, using the same response distribution as the fitted GLM. Contributions are nonnegative: the saturated model can fit an individual observation at least as well as the more restricted fitted model. A contribution of zero occurs when the fitted value matches the saturated value for that observation.
Poisson Casewise Contributions
Suppose the responses \(Y_1,\ldots,Y_n\) are independent Poisson random variables, with fitted means \(\hat{\mu}_i>0\). The observed count for case \(i\) is \(y_i\), a nonnegative integer. The Poisson casewise deviance contribution is
When \(y_i=0\), the term \(y_i\log(y_i/\hat{\mu}_i)\) is defined by its limiting value, zero. Therefore, a zero count contributes \(d_i=2\hat{\mu}_i\). This convention is important: the formula remains well-defined even though \(\log(0)\) alone is not.
Worked Example: Finding the Largest Poisson Contribution
A hypothetical insurer fits a Poisson model to claim counts for three policy groups. The observed counts and fitted means are \((y_i,\hat{\mu}_i)=(0,2),(3,3),(6,3)\). Calculate each contribution, the total deviance, and identify the largest contributor. Assume the observations are independent and their fitted means are positive.
Method. Apply the Poisson casewise formula to each pair. The common mistake to avoid is treating a zero count as undefined instead of using the limiting value.
For the first group, \(y_1=0\) and \(\hat{\mu}_1=2\). Hence
For the second group, \(y_2=\hat{\mu}_2=3\), so
For the third group, \(y_3=6\) and \(\hat{\mu}_3=3\):
Adding the three values gives \(D=4.0000+0+2.3178=6.3178\). The first group has the largest contribution, even though the third group’s observed count is also quite different from its fitted mean. The zero count is poorly represented by a fitted mean of two. The calculation is checked by confirming that every contribution is nonnegative and that the contributions sum to the stated total.
Binomial and Bernoulli Contributions
For a grouped binomial observation, let \(n_i\) be the number of trials, \(y_i\) the number of successes, and \(\hat{p}_i\) the fitted success probability, with \(0<\hat{p}_i<1\). The fitted mean number of successes is \(n_i\hat{p}_i\). The casewise deviance contribution is
A term with zero observed successes or zero observed failures is interpreted by continuity as zero. For example, if \(y_i=0\), the first term is zero; the second term remains and compares the observed zero successes with the fitted probability. The contribution is zero when the observed proportion \(y_i/n_i\) equals \(\hat{p}_i\).
A Bernoulli response is the special case \(n_i=1\). If the observed outcome is \(y_i=1\), its contribution is \(-2\log(\hat{p}_i)\). If \(y_i=0\), its contribution is \(-2\log(1-\hat{p}_i)\). These can be very different for the same fitted probability, depending on which outcome occurred.
Worked Example: Comparing Grouped Binomial Contributions
A hypothetical benefits administrator models whether applications are approved. Two independent groups have fitted approval probability \(\hat{p}=0.6\). In Group A, 8 of 10 applications are approved; in Group B, 2 of 2 are approved. Calculate each grouped binomial contribution and determine which group contributes more to deviance.
Method. Use the grouped binomial formula, retaining both the number of successes and the number of failures. A common error is to use only the success term, which would omit information from observed failures.
For Group A, \(n_A=10\), \(y_A=8\), and \(n_A-y_A=2\):
For Group B, \(n_B=2\), \(y_B=2\), and there are no failures. The failure term is zero by convention:
Group B contributes more: \(2.0433>1.8303\). The total for these two observations is \(1.8303+2.0433=3.8736\). Although Group A has more applications and a success proportion of \(0.8\), Group B’s all-success result is more discrepant from the fitted probability \(0.6\). The calculation is checked by verifying that the zero-failure term is omitted, not evaluated as a logarithm of zero, and that the total equals the sum of both group contributions.
Reading Contributions in a Fitted Model
A contribution is on the deviance scale and reflects the discrepancy between the observed response and its fitted distribution. It is not a signed quantity: it does not indicate whether the observation is above or below the fitted value. Nor is it automatically a standardized measure that can be compared with a universal cutoff. Its magnitude depends on the response family, the fitted value, and, for grouped binomial observations, the number of trials.
For count data with an exposure offset, the fitted mean usually depends on exposure. If a Poisson model specifies a rate \(r\) and exposure \(e_i\), then \(\hat{\mu}_i=e_i\hat{r}_i\). The contribution uses this fitted expected count, not the rate alone. Comparing observed counts directly to rates would mix different units and give an invalid calculation.
Worked Example: Exposure and a Dominant Count Contribution
A hypothetical portfolio has counts modeled as independent Poisson responses with a common fitted claim rate of \(0.5\) claims per exposure unit. Three policy groups have exposures \(1,4,4\) and observed counts \(0,4,9\), respectively. Calculate their fitted means and casewise contributions, then identify the case that dominates the total deviance.
Method. Convert each rate to an expected count by multiplying by exposure, then apply the Poisson formula. The trap is substituting the rate \(0.5\) for the expected count in every case.
The fitted means are \(\hat{\mu}_1=1(0.5)=0.5\), \(\hat{\mu}_2=4(0.5)=2\), and \(\hat{\mu}_3=4(0.5)=2\).
For the first group, the observed count is zero:
For the second group:
For the third group:
The total deviance is \(1.0000+1.5452+13.0734=15.6186\), rounded to four decimal places. The third group dominates, contributing about \(13.0734/15.6186=0.8370\), or \(83.70\%\), of this total. This calculation is checked by using expected counts \(0.5,2,2\), each consistent with its exposure, and by confirming that the contributions sum to the reported total.
What a Large Contribution Does—and Does Not—Show
A large casewise contribution points to a response that the fitted model represents poorly relative to a saturated fit. It can prompt review of the data, the exposure or trial count, the model specification, or whether the observation belongs to a distinct population. The contribution alone does not determine which explanation is correct.
The size of a grouped binomial contribution is influenced by group size: more trials can make a discrepancy in proportions more consequential. Similarly, a Poisson count should be considered relative to its fitted mean, which may reflect exposure. Therefore, ranking contributions is useful for locating where deviance is concentrated, but it is not the same as ranking cases by raw residual or declaring an outlier using a fixed threshold.
For the standard Poisson or binomial likelihood, the total residual deviance is obtained by summing the appropriate casewise values. This decomposition is exact, not an approximation. It makes the overall statistic interpretable at the observation level while preserving the distinction between an overall goodness-of-fit summary and further diagnostics.
Check Your Understanding
For each problem, calculate the requested contribution or total. Round numerical values to four decimal places where needed.
- A Poisson observation has \(y=0\) and fitted mean \(\hat{\mu}=1.5\). What is its casewise deviance contribution? (Answer: 3.0000)
- A Poisson count is \(y=2\), with fitted mean \(\hat{\mu}=4\). Calculate its casewise contribution. (Answer: 1.2274)
- A Bernoulli observation has outcome \(y=0\) and fitted success probability \(\hat{p}=0.25\). Calculate its contribution. (Answer: 0.5754)
- A grouped binomial observation has \(n=5\), \(y=4\), and fitted success probability \(\hat{p}=0.5\). Calculate its contribution, including the failure term. (Answer: 1.9275)
- A Poisson observation has observed count \(y=6\) and fitted mean \(\hat{\mu}=2\). A second independent observation has \(y=2\) and \(\hat{\mu}=2\). Calculate the total deviance and identify the larger contributor. (Answer: Total deviance \(=5.1833\); the first observation is the larger contributor.)