From Likelihood to Deviance
A residual records how an observed response differs from its fitted mean, but a raw difference alone does not reflect the response model’s likelihood. For an inverse-Gaussian response, the likelihood supplies a model-based measure of discrepancy: the unit deviance. Its signed square root gives a residual whose sign indicates the direction of the discrepancy and whose square is the unit deviance.
The derivation compares two likelihoods for the same observed response: the likelihood under the fitted mean, and the likelihood under a saturated model that fits that response exactly. Keeping the dispersion factor visible in this comparison is important: the conventional deviance and the likelihood-ratio statistic differ by that factor.
Deriving the Unit Deviance
Take the logarithm of the density. When comparing fitted and saturated likelihoods for the same \(y\) and \(\phi\), the density’s normalizing term is identical in both cases. At the saturated mean, the exponential term is one because \(y-\mu_{\mathrm{sat}}=0\). Thus the log-likelihood difference is determined entirely by the fitted model’s exponential term.
For a fixed observed \(y>0\), take the logarithm of the density at the fitted mean \(\mu>0\).
Set \(\mu_{\mathrm{sat}}=y\); the squared difference in the exponential term becomes zero.
The conventional unit deviance is the likelihood contrast with the factor \(1/\phi\) removed.
For one observation, write \(\ell(\mu;y,\phi)=\log f(y;\mu,\phi)\), and let \(\ell_{\mathrm{sat}}(y,\phi)=\ell(y;y,\phi)\). The two log-likelihoods are
Subtracting gives \(2\{\ell_{\mathrm{sat}}-\ell(\mu;y,\phi)\}=(y-\mu)^2/(\phi\mu^2y)\). Therefore the conventional inverse-Gaussian unit deviance is
This derivation proves the result for every \(y>0\), \(\mu>0\), and \(\phi>0\). In particular, \(d(y,\mu)\geq 0\), since its numerator is a square and its denominator is positive; it is zero exactly when \(y=\mu\). The unscaled likelihood-ratio statistic is \(2\{\ell_{\mathrm{sat}}-\ell\}=d(y,\mu)/\phi\). For independent observations, the conventional model deviance sums their unit deviances, while the corresponding twice-log-likelihood contrast is that sum divided by \(\phi\) when the observations share a common dispersion.
Signed Deviance Residuals
The unit deviance measures discrepancy without recording whether the fitted mean is too high or too low. The signed deviance residual attaches the direction of the raw residual \(y-\mu\) to the square root of the unit deviance. Define \(\operatorname{sign}(0)=0\).
To verify the simplified expression, positivity of \(\mu\) and \(y\) gives \(\sqrt{d(y,\mu)}=|y-\mu|/(\mu\sqrt{y})\). Multiplication by \(\operatorname{sign}(y-\mu)\) replaces the absolute value with \(y-\mu\), including the zero case. Squaring the resulting residual returns \((y-\mu)^2/(y\mu^2)=d(y,\mu)\). Thus the residual retains the unit deviance’s magnitude information while restoring the direction.
For a fitted model, the observation is \(y_i\) and its fitted response is \(\hat\mu_i\). The residual is therefore \(r_{D,i}=(y_i-\hat\mu_i)/(\hat\mu_i\sqrt{y_i})\). The conventional deviance residual uses the unit deviance, not the likelihood contrast divided by \(\phi\). If one instead wants a signed square root of the dispersion-scaled likelihood contrast, it is \(r_{D,i}/\sqrt{\phi}\). These quantities should not be interchanged without stating which scale is being used.
Worked Calculations
Worked Example: Checking the Likelihood Contrast
Suppose \(y=4\), \(\mu=2\), and \(\phi=0.5\). Calculate the unit deviance and compare it with the twice-log-likelihood contrast.
The unit deviance is
The likelihood calculation must include the dispersion:
The likelihood contrast is \(1/2\), whereas the conventional unit deviance is \(1/4\). Their difference is the factor \(1/\phi=2\), as required by the derivation.
Worked Example: A Negative Deviance Residual
An observation is \(y=1\), and its fitted mean is \(\hat\mu=2\). Find its unit deviance and signed deviance residual.
First calculate the unit deviance:
Since \(y-\hat\mu=1-2=-1\), the residual is negative. Its magnitude is \(\sqrt{1/4}=1/2\), so \(r_D=-1/2\). Direct substitution confirms the result:
The negative sign indicates that the fitted mean exceeds the observed response. The calculation does not require a dispersion value because this is the conventional, unscaled deviance residual.
Worked Example: Residuals and Total Deviance for Three Responses
Consider three positive observations with fitted means \((y_1,y_2,y_3)=(4,1,9)\) and \((\hat\mu_1,\hat\mu_2,\hat\mu_3)=(2,2,3)\). Calculate each unit deviance and signed deviance residual, then sum the unit deviances.
For the first observation,
For the second observation,
For the third observation,
The total conventional deviance is
The first two observations have equal unit deviances but opposite-signed residuals. Their directions differ, even though the unit deviance itself records only discrepancy magnitude.
Interpretation and Common Pitfall
A deviance residual is not a raw residual: its denominator depends on both the fitted mean and the observed response. Nor is it generally the Pearson residual, which for an inverse-Gaussian response uses the model variance \(\operatorname{Var}(Y)=\phi\mu^3\). The deviance residual instead comes from the saturated-versus-fitted likelihood comparison. These residuals answer related but distinct questions and need not have the same numerical values.
- Pitfall: dropping \(\mu^2\) from the denominator. The inverse-Gaussian unit deviance is \((y-\mu)^2/(y\mu^2)\), not a squared difference divided by \(y\mu\). The \(\mu^2\) follows directly from the exponent in the inverse-Gaussian density.
- Pitfall: treating the likelihood contrast as the unit deviance. The twice-log-likelihood contrast is \(d(y,\mu)/\phi\); the conventional unit deviance is \(d(y,\mu)\). Check whether a calculation asks for the conventional deviance or the dispersion-scaled likelihood contrast.
- Pitfall: taking only a positive square root. The unsigned square root loses whether the response is above or below its fitted mean. Use \(\operatorname{sign}(y-\mu)\sqrt{d(y,\mu)}\).
The deviance is useful because it turns the fitted-versus-saturated likelihood difference into an additive discrepancy measure across observations. Its signed residuals also preserve the direction of each observation’s departure from its fitted mean. Both rely on positive observed responses and positive fitted means; the inverse-Gaussian support and mean domain make these conditions essential, not optional.
Check Your Understanding
Use the likelihood contrast and residual definitions above to answer these questions.
- For \(y=6\) and \(\mu=3\), calculate the unit deviance and signed deviance residual.
- If a unit deviance is \(0.36\), what are the possible signed deviance residuals, and what information determines the sign?
- For fixed \(y\) and \(\mu\), how does the twice-log-likelihood contrast change when \(\phi\) doubles?
- Why does the saturated log-likelihood have the same normalizing term as the fitted log-likelihood?
- Explain why a signed deviance residual should not automatically be reported as the signed square root of \(d(y,\mu)/\phi\).