Why Deviance Residuals Start With Likelihood
A response residual compares an observed value with its fitted mean, while a Pearson residual also uses the model’s variance to scale that difference. A deviance residual instead starts with a likelihood comparison: for one observation, how much worse does the fitted model explain the data than a model that fits that observation perfectly? The comparison is useful because it respects the response distribution. A difference of a given size need not have the same evidential weight for claim counts as for claim severity.
This tutorial uses \(y_i\) for the observed response and \(\hat{\mu}_i\) for its fitted mean. The fitted mean may depend on predictors, an offset, and the chosen link function. Once \(\hat{\mu}_i\) is obtained, the observation-level deviance calculation depends on the response distribution and any relevant dispersion or frequency weight.
The square root gives a residual on a signed scale: observations above their fitted means have positive deviance residuals, and observations below their fitted means have negative ones. Its magnitude comes from the likelihood-based discrepancy, not simply from the absolute difference \( |y-\hat{\mu}| \). The unit deviance is nonnegative under the stated model, so the square root is defined.
Unit Deviance and Dispersion Are Not the Same Quantity
A distinction between conventional deviance and a likelihood-ratio difference is essential. In an exponential-dispersion model, suppose independent observations have log likelihood contributions of the form $$ \ell_i(\theta_i,\phi)=\frac{w_i}{\phi}\{y_i\theta_i-b(\theta_i)\}+c(y_i,\phi,w_i), $$ where \(\theta_i\) is the canonical parameter, \(\mu_i=b'(\theta_i)\), \(\phi\) is a common dispersion parameter, and \(w_i\) is a frequency weight. Assume the same dispersion and observation structure are used for the fitted and saturated models. The saturated model chooses a separate parameter for each observation so that its fitted mean equals that observation’s response, when that value is in the response model’s support.
The conventional unit deviance is defined from the likelihood contrast without the factor \(1/\phi\). Thus the actual twice-log-likelihood difference is the weighted conventional deviance divided by \(\phi\). For models with fixed dispersion \(\phi=1\), such as the ordinary Poisson and binomial models, these quantities coincide. When dispersion is present, they do not.
This convention keeps the unit deviance formulas comparable across models, while making the dispersion adjustment explicit. Some software reports conventional deviance residuals and some diagnostics use residuals divided by \(\sqrt{\phi}\); always identify which is being used. For a quasi-likelihood model, a full likelihood-ratio interpretation may not be available, even though a conventional deviance expression can still be used as a diagnostic.
Deriving the Likelihood-Based Contribution
The reason the unit deviance has the form it does follows directly from the saturated-versus-fitted comparison. Under the exponential-dispersion assumptions above, let \(\theta_y\) be the saturated canonical parameter, so \(b'(\theta_y)=y\), and let \(\theta\) be the fitted canonical parameter, so \(b'(\theta)=\mu\). The terms \(c(y,\phi,w)\) cancel because they are the same in the two likelihood contributions.
This calculation justifies both the unit deviance and the dispersion factor: the bracketed contrast, multiplied by two, is the conventional unit deviance, while the likelihood itself scales that contrast by \(1/\phi\). The saturated model fits the observation at least as well as the constrained fitted model, so the likelihood contrast, and hence the unit deviance, is nonnegative. A link function determines how predictors produce \(\hat{\mu}\), but it does not change this observation-level comparison once the fitted mean and response distribution are specified.
Common Unit Deviances for Ratemaking Responses
The following formulas assume the indicated response distribution and its standard parameterization. For the Poisson and binomial models, dispersion is fixed at one. The Gaussian and Gamma formulas are conventional unit deviances; if their dispersion is estimated, divide the weighted deviance by \(\phi\) to obtain the actual twice-log-likelihood difference.
| Response model | Unit deviance \(d(y,\mu)\) | Conditions and convention |
|---|---|---|
| Poisson count | \(2[y\log(y/\mu)-(y-\mu)]\) | \(y\) is a nonnegative integer, \(\mu>0\), and \(0\log(0/\mu)\) is defined as zero. |
| Gaussian response | \((y-\mu)^2\) | \(Y\sim N(\mu,\phi)\), with variance \(\phi\); the likelihood-ratio contribution is \(d/\phi\). |
| Gamma response | \(2[(y-\mu)/\mu-\log(y/\mu)]\) | \(y>0,\mu>0\), and \(\operatorname{Var}(Y)=\phi\mu^2\); the likelihood-ratio contribution is \(d/\phi\). |
| Binomial count | \(2[y\log\{y/(np)\}+(n-y)\log\{(n-y)/(n(1-p))\}]\) | \(y\) successes from \(n\) trials, fitted success probability \(p\); zero-count log terms are zero. |
For a binomial response, the fitted mean is \(\mu=np\). The formula compares the fitted success and failure probabilities with the saturated proportions \(y/n\) and \((n-y)/n\). For a Bernoulli response, set \(n=1\). In all four cases the sign is determined by \(y-\hat{\mu}\), not by the sign of a link-scale error.
Worked Example: Poisson Claim Count Below Its Fitted Mean
Method and assumptions. A hypothetical policy has one annual claim count \(Y\) modeled as Poisson with fitted mean \(\hat{\mu}=5\). The observed count is \(y=3\). Use the standard Poisson deviance, with fixed dispersion \(\phi=1\), and no frequency weight. Find the unit deviance and deviance residual. The common mistake to avoid is reversing the sign because the fitted mean exceeds the observation.
Substitute \(y=3\) and \(\hat{\mu}=5\) into the Poisson unit deviance:
Because \(3-5=-2\), the residual is negative. Thus \(r_D=-\sqrt{0.935046}\approx-0.9670\), to four decimal places. The check is consistent: the deviance is nonnegative, and a count below its fitted mean has a negative residual. The Poisson model has \(\phi=1\), so no additional dispersion adjustment is made.
Worked Example: Gamma Severity and Dispersion Adjustment
Method and assumptions. A hypothetical claim severity is modeled with a Gamma response, mean \(\hat{\mu}=\$1{,}000\), and variance \(\operatorname{Var}(Y)=\phi\mu^2\), where \(\phi=0.16\). The observed severity is \(y=\$1{,}500\). Treat the observation as having frequency weight one. Calculate the conventional deviance residual and the dispersion-adjusted residual. The mistake to avoid is multiplying the conventional deviance by \(1/\phi\) before taking a square root and then forgetting that this changes the residual scale.
The ratio is \(y/\hat{\mu}=1.5\), and \((y-\hat{\mu})/\hat{\mu}=0.5\). Therefore,
Since \(y-\hat{\mu}=500>0\), the conventional deviance residual is positive: \(r_D=+\sqrt{0.1890697838}\approx+0.4348\). The likelihood-ratio contribution is \(d/\phi=0.1890697838/0.16=1.1816861488\). Equivalently, the dispersion-adjusted residual is \(r_D/\sqrt{0.16}=0.434821\ldots/0.4=+1.0871\), to four decimal places. Squaring \(1.0871\) gives approximately \(1.1818\), consistent with the likelihood-ratio contribution after rounding. The two residual values differ only because they use different scales.
Worked Example: Gaussian Response With Nonunit Dispersion
Method and assumptions. A hypothetical grouped loss-cost response is modeled as \(Y\sim N(\mu,\phi)\), with fitted mean \(\hat{\mu}=10\), known variance \(\phi=0.25\), and observed value \(y=12\). There is one observation and no frequency weight. Find the conventional deviance residual and the dispersion-adjusted deviance residual. The trap is to use the Gaussian likelihood-ratio contribution \(d/\phi\) as though it were the conventional deviance.
The Gaussian unit deviance is the squared difference:
The conventional residual is positive because \(12>10\), and equals \(+\sqrt{4}=+2\). For the likelihood-ratio scale, divide the unit deviance by the variance: \(4/0.25=16\). Its signed square root, or equivalently \(2/\sqrt{0.25}\), is \(+4\). Thus the conventional deviance is 4, while the actual twice-log-likelihood difference is 16. This checks the stated dispersion relationship and shows why the scale must be named.
Interpreting Signs, Magnitudes, and Weights
A positive deviance residual indicates underprediction of the response; a negative one indicates overprediction. For example, a positive residual for claim severity means observed severity exceeded the fitted mean. A larger absolute residual means a larger likelihood-based discrepancy under the specified response distribution, but it is not automatically a formal significance measure. It has not, by itself, been adjusted for leverage, parameter estimation, or multiple inspection of observations.
A frequency weight represents the number of identical independent observations summarized by a row. If a row has frequency weight \(w\), its conventional deviance contribution is \(w d\), so its deviance residual magnitude is multiplied by \(\sqrt{w}\), not \(w\). This rule is for frequency weights; other weighting conventions can change the variance or likelihood interpretation and should not be silently treated as frequency weights. Offsets and exposures influence the fitted mean through the model, but do not create an extra multiplier in the unit-deviance formula once \(\hat{\mu}\) is known.
Determine whether the response is Poisson, Gaussian, Gamma, binomial, or another specified family, and check its support.
Use the model’s fitted \(\hat{\mu}_i\), and identify whether the row has a frequency weight. Do not confuse exposure used to obtain the mean with a residual weight.
Evaluate \(w_i d(y_i,\hat{\mu}_i)\), using the formula for the response family and the zero-term convention where needed.
Take the square root and give it the sign of \(y_i-\hat{\mu}_i\). If a dispersion-adjusted residual is requested, divide by \(\sqrt{\phi}\).
Common Exam Trap: Confusing Deviance With Its Scaled Version
Suppose a Gamma model has \(y=800\), \(\hat{\mu}=1{,}000\), and \(\phi=0.25\). A common incorrect calculation calls \(d/\phi\) the conventional deviance and reports its square root without stating that the result is dispersion-adjusted. The unit deviance is instead \(2[-0.2-\log(0.8)]=0.0462871\) (to seven decimal places). The conventional residual is negative and approximately \(-0.2151\). The actual twice-log-likelihood contribution is \(0.0462871/0.25=0.1851484\), so the dispersion-adjusted residual is approximately \(-0.4303\). Both residuals are computable, but they answer different scaling conventions; label the requested quantity before calculating.
This distinction matters in ratemaking model assessment because dispersion estimates can differ across response families or data groupings. A residual’s sign continues to express direction of error, but its magnitude changes under dispersion scaling. Deviance residuals therefore help locate observations poorly represented by the likelihood model; they do not, on their own, establish a model’s overall adequacy or identify the cause of misfit. Those broader interpretations require additional diagnostics.
Check Your Understanding
For each problem, identify the relevant scale and use the residual sign convention.
- A hypothetical Poisson model for annual service calls has fitted mean \(2\) and observed count \(0\), with no weight. Find the unit deviance and deviance residual. (Answer: \(d=4.0000,\ r_D=-2.0000\))
- A hypothetical Gaussian response has \(y=8\), fitted mean \(10\), and variance \(\phi=1\), with no weight. Find the conventional deviance residual and explain its sign. (Answer: \(-2.0000\), because \(y<\hat{\mu}\))
- A hypothetical Gamma severity model has \(y=800\), \(\hat{\mu}=1{,}000\), and \(\phi=0.25\), with no weight. Find the unit deviance and dispersion-adjusted residual. (Answer: \(d=0.0462871,\ r_D/\sqrt{\phi}=-0.4303\))
- A hypothetical binomial model has \(n=20\) trials, fitted success probability \(p=0.5\), and \(y=15\) observed successes. Find the binomial unit deviance and deviance residual. (Answer: \(d=5.2324814,\ r_D=+2.2875\))
- A hypothetical Poisson row summarizes three independent policies with the same fitted mean \(\hat{\mu}=1\) and observed count \(y=2\) on each policy, so its frequency weight is \(w=3\). Find the weighted conventional deviance contribution and its deviance residual. (Answer: \(w d=2.3177662,\ r_D=+1.5224\))