Tutorials › Generalized Linear Models › Inverse-Gaussian Deviance Contributions

Inverse-Gaussian Models · Tutorial 603 of 981

Inverse-Gaussian Deviance Contributions

Derive the inverse-Gaussian unit deviance from the likelihood and use it to calculate and interpret signed deviance residuals.

Advanced 10 min read

What You'll Learn

  • Write the inverse-Gaussian likelihood for one positive response and its fitted mean.
  • Derive the unit deviance from the saturated and fitted likelihoods.
  • Distinguish the conventional deviance from the dispersion-scaled likelihood-ratio statistic.
  • Calculate signed deviance residuals from observed responses and fitted means.
  • Interpret the residual’s sign, magnitude, and relationship to the unit deviance.
  • Avoid confusing deviance residuals with Pearson residuals or raw residuals.

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.

Setup: Let \(Y\) have an inverse-Gaussian distribution with mean \(\mu>0\) and dispersion \(\phi>0\). For an observed value \(y>0\), its density is
$$ f(y;\mu,\phi) = \left(\frac{1}{2\pi\phi y^3}\right)^{1/2} \exp\left\{-\frac{(y-\mu)^2}{2\phi\mu^2 y}\right\}. $$
The fitted mean and the saturated mean must both be positive. The saturated model for this observation sets its mean equal to the observation, \(\mu_{\mathrm{sat}}=y\).

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.

1
Write the fitted log-likelihood.
For a fixed observed \(y>0\), take the logarithm of the density at the fitted mean \(\mu>0\).
2
Evaluate the saturated log-likelihood.
Set \(\mu_{\mathrm{sat}}=y\); the squared difference in the exponential term becomes zero.
3
Subtract and identify the scale.
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

$$ \ell(\mu;y,\phi) = -\frac12\log(2\pi\phi y^3) -\frac{(y-\mu)^2}{2\phi\mu^2 y}, \qquad \ell_{\mathrm{sat}}(y,\phi) = -\frac12\log(2\pi\phi y^3). $$

Subtracting gives \(2\{\ell_{\mathrm{sat}}-\ell(\mu;y,\phi)\}=(y-\mu)^2/(\phi\mu^2y)\). Therefore the conventional inverse-Gaussian unit deviance is

$$ d(y,\mu) = 2\phi\{\ell_{\mathrm{sat}}(y,\phi)-\ell(\mu;y,\phi)\} = \frac{(y-\mu)^2}{y\mu^2}. $$

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.

Theorem: For one inverse-Gaussian observation with \(y>0\), fitted mean \(\mu>0\), and dispersion \(\phi>0\), the saturated-versus-fitted likelihood contrast is \(2\{\ell_{\mathrm{sat}}-\ell\}=d(y,\mu)/\phi\), where \(d(y,\mu)=(y-\mu)^2/(y\mu^2)\). The unit deviance is nonnegative and vanishes if and only if the fitted mean equals the observed response.

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\).

Definition: For \(y>0\) and fitted mean \(\mu>0\), the signed deviance residual is
$$ r_D(y,\mu) = \operatorname{sign}(y-\mu)\sqrt{d(y,\mu)} = \frac{y-\mu}{\mu\sqrt{y}}. $$
It is positive when \(y>\mu\), negative when \(y<\mu\), and zero when \(y=\mu\).

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

$$ d(4,2) = \frac{(4-2)^2}{4(2)^2} = \frac{4}{16} = \frac14. $$

The likelihood calculation must include the dispersion:

$$ 2\{\ell_{\mathrm{sat}}-\ell(2;4,0.5)\} = \frac{d(4,2)}{0.5} = \frac{1/4}{1/2} = \frac12. $$

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:

$$ d(1,2) = \frac{(1-2)^2}{1(2)^2} = \frac14. $$

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:

$$ r_D(1,2) = \frac{1-2}{2\sqrt{1}} = -\frac12, \qquad r_D(1,2)^2=\frac14=d(1,2). $$

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,

$$ d_1=\frac{(4-2)^2}{4(2)^2}=\frac14, \qquad r_{D,1}=\frac{4-2}{2\sqrt4}=\frac12. $$

For the second observation,

$$ d_2=\frac{(1-2)^2}{1(2)^2}=\frac14, \qquad r_{D,2}=\frac{1-2}{2\sqrt1}=-\frac12. $$

For the third observation,

$$ d_3=\frac{(9-3)^2}{9(3)^2}=\frac{36}{81}=\frac49, \qquad r_{D,3}=\frac{9-3}{3\sqrt9}=\frac{6}{9}=\frac23. $$

The total conventional deviance is

$$ D=d_1+d_2+d_3 = \frac14+\frac14+\frac49 = \frac12+\frac49 = \frac{17}{18}. $$

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.

  1. For \(y=6\) and \(\mu=3\), calculate the unit deviance and signed deviance residual.
  2. If a unit deviance is \(0.36\), what are the possible signed deviance residuals, and what information determines the sign?
  3. For fixed \(y\) and \(\mu\), how does the twice-log-likelihood contrast change when \(\phi\) doubles?
  4. Why does the saturated log-likelihood have the same normalizing term as the fitted log-likelihood?
  5. Explain why a signed deviance residual should not automatically be reported as the signed square root of \(d(y,\mu)/\phi\).
Clinical Biostats