Tutorials › Generalized Linear Models › Choosing Between Gamma and Inverse-Gaussian Models

Choosing Continuous Families · Tutorial 637 of 981

Choosing Between Gamma and Inverse-Gaussian Models

Learn how gamma and inverse-Gaussian models differ in variance growth and shape, and how to use those differences alongside residual patterns when choosing between them.

Intermediate 12 min read

What You'll Learn

  • State the mean and variance functions for gamma and inverse-Gaussian responses.
  • Compare how each family’s variance changes as the mean increases.
  • Relate dispersion and mean to the families’ standardized skewness.
  • Calculate and interpret Pearson residuals under both candidate models.
  • Use observed mean–variance patterns and residual behavior as evidence for family choice.
  • Recognize why a small number of group summaries cannot settle the choice.

Why Compare These Two Families?

A strictly positive response can be strongly right-skewed, making a Gaussian model a poor description of its conditional distribution. The gamma and inverse-Gaussian families are two common alternatives: both have positive support and allow variance to increase with the mean, but they imply different rates of variance growth. That difference gives a practical starting point for choosing between them.

Neither family should be selected just because a response is positive or skewed. The choice should be consistent with the observed relationship between mean and variance, and the fitted model should not leave systematic patterns in residuals. These are pieces of evidence, not mechanical rules: sampling noise, small samples, and an incorrect model for the mean can all make the evidence misleading.

Mean, Variance, and Shape

Let \(Y\) be a strictly positive response with conditional mean \(\mu=E[Y]\) and dispersion parameter \(\phi>0\). In the parameterizations used here, the gamma and inverse-Gaussian variance functions are as follows.

Definition: A gamma response with mean \(\mu>0\) and dispersion \(\phi>0\) has variance \(\operatorname{Var}(Y)=\phi\mu^2\). Equivalently, it has a gamma distribution with shape \(1/\phi\) and scale \(\phi\mu\). An inverse-Gaussian response with mean \(\mu>0\) and dispersion \(\phi>0\) has variance \(\operatorname{Var}(Y)=\phi\mu^3\). Both distributions have support \(y>0\).

The same symbol \(\phi\) has the same role in each variance function, but its numerical value need not be the same when fitting the two families. A dispersion value belongs to a particular family and its parameterization. To compare the families fairly, it is often useful to compare their variances at a reference mean, rather than assume their fitted dispersions match.

The gamma variance grows quadratically with the mean; the inverse-Gaussian variance grows cubically. Thus, if the mean doubles while dispersion stays fixed, the gamma variance is multiplied by four, whereas the inverse-Gaussian variance is multiplied by eight. The following result makes this contrast precise.

Result: If the mean changes from \(\mu\) to \(c\mu\), where \(c>0\), and dispersion is held fixed, the gamma variance changes by a factor of \(c^2\) and the inverse-Gaussian variance by a factor of \(c^3\).

Justification. For the gamma family,

$$ \frac{\operatorname{Var}(Y\mid \text{mean }c\mu)} {\operatorname{Var}(Y\mid \text{mean }\mu)} = \frac{\phi(c\mu)^2}{\phi\mu^2} =c^2. $$

For the inverse-Gaussian family, the same calculation gives

$$ \frac{\phi(c\mu)^3}{\phi\mu^3}=c^3. $$

These ratios concern the variance at two means under a fixed-dispersion model. They do not say that every individual observation will follow a smooth variance curve, nor that variance estimates from small groups will reveal the curve exactly. \(\square\)

The families also differ in standardized skewness. For the gamma family, skewness is \(2\sqrt{\phi}\), independent of the mean. For the inverse-Gaussian family, it is \(3\sqrt{\phi\mu}\), so skewness increases with the mean when dispersion is fixed. These formulas describe the distributions implied by the models; they are not guarantees that a particular sample will visibly display the difference.

Result: Under the stated parameterizations, the gamma skewness is \(2\sqrt{\phi}\), and the inverse-Gaussian skewness is \(3\sqrt{\phi\mu}\).

Derivation. For a gamma variable with shape \(1/\phi\) and scale \(\phi\mu\), its cumulant-generating function is \(K(t)=-(1/\phi)\log(1-\phi\mu t)\), for \(t<1/(\phi\mu)\). Differentiating at zero gives the second and third cumulants, \(\kappa_2=\phi\mu^2\) and \(\kappa_3=2\phi^2\mu^3\). Since skewness is the third central moment divided by the variance to the power \(3/2\), it is

$$ \frac{\kappa_3}{\kappa_2^{3/2}} = \frac{2\phi^2\mu^3}{(\phi\mu^2)^{3/2}} =2\sqrt{\phi}. $$

For an inverse-Gaussian variable in this parameterization, the cumulant-generating function is \(K(t)=(1/(\phi\mu))(1-\sqrt{1-2\phi\mu^2t})\), for \(t<1/(2\phi\mu^2)\). Differentiating twice and three times at zero gives \(\kappa_2=\phi\mu^3\) and \(\kappa_3=3\phi^2\mu^5\). Therefore,

$$ \frac{\kappa_3}{\kappa_2^{3/2}} = \frac{3\phi^2\mu^5}{(\phi\mu^3)^{3/2}} =3\sqrt{\phi\mu}. $$

The cumulants used here exist because the moment-generating functions are finite in an open interval containing zero. \(\square\)

Worked Example: Matching Variance at a Reference Mean

Suppose a positive response has mean \(10\), and compare a gamma model with \(\phi=0.20\) to an inverse-Gaussian model with \(\phi=0.02\). These values are chosen to give the same variance at this mean.

For the gamma model, \(\operatorname{Var}(Y)=0.20(10^2)=20\). For the inverse-Gaussian model, \(\operatorname{Var}(Y)=0.02(10^3)=20\). Thus both models have standard deviation \(\sqrt{20}\), approximately \(4.47\), at mean \(10\).

Now compare their variances at mean \(20\), keeping each model’s dispersion fixed. The gamma variance is \(0.20(20^2)=80\); the inverse-Gaussian variance is \(0.02(20^3)=160\). Starting from the same variance at mean \(10\), the mean has doubled, and the variance has quadrupled under gamma but increased eightfold under inverse-Gaussian. The different growth rates, not the two different dispersion values alone, explain the separation.

Using Mean–Variance Patterns

When several groups or covariate regions have different fitted means, their response variability can provide evidence about the family. The basic comparison is whether a variance proportional to \(\mu^2\) or to \(\mu^3\) better describes the data, allowing for an unknown dispersion. In an exploratory summary, one can compare ratios of estimated variance to the corresponding power of the estimated mean. A roughly stable ratio across groups is compatible with that variance function.

This comparison needs care. Group variances are themselves noisy estimates, especially when groups contain few observations. Also, these summaries are most interpretable when groups are reasonably comparable and their means are estimated sensibly. A trend in group variances can reflect an omitted predictor, dependence, or a misspecified mean structure, rather than the wrong choice between gamma and inverse-Gaussian responses.

Worked Example: A Pattern More Consistent With Gamma Variance Growth

Three groups have estimated means \(5\), \(10\), and \(20\), with estimated variances \(2.5\), \(10\), and \(40\), respectively. Check whether the variance-to-mean-squared ratios are stable.

The ratios are \(2.5/5^2=2.5/25=0.10\), \(10/10^2=10/100=0.10\), and \(40/20^2=40/400=0.10\). Thus, these summaries follow the gamma pattern \(\widehat{\operatorname{Var}}(Y)\approx 0.10\mu^2\).

For comparison, the variance-to-mean-cubed ratios are \(2.5/125=0.02\), \(10/1000=0.01\), and \(40/8000=0.005\), which are not stable. This small set of summaries is more compatible with gamma variance growth. It does not prove that individual responses follow a gamma distribution or that the mean model is correct.

Worked Example: A Pattern More Consistent With Inverse-Gaussian Variance Growth

Now consider estimated means \(2\), \(4\), and \(8\), and estimated variances \(0.4\), \(3.2\), and \(25.6\). For the inverse-Gaussian variance function, the ratios are \(0.4/2^3=0.05\), \(3.2/4^3=3.2/64=0.05\), and \(25.6/8^3=25.6/512=0.05\). They are constant, as the inverse-Gaussian pattern suggests.

The gamma ratios are \(0.4/2^2=0.10\), \(3.2/4^2=0.20\), and \(25.6/8^2=0.40\). They double as the mean doubles, so a single constant gamma dispersion does not describe these summaries as well. Again, this is evidence about variance growth, not a complete check of the conditional distribution.

Residual Behavior as a Second Check

A variance function affects how large a response’s deviation from its fitted mean is expected to be. For a fitted mean \(\hat{\mu}_i>0\), a Pearson residual under a candidate family is \(r_{Pi}=(y_i-\hat{\mu}_i)/\sqrt{V(\hat{\mu}_i)}\), where \(V(\hat{\mu}_i)\) is that family’s variance function evaluated at the fitted mean, including its dispersion. Under the gamma model this denominator is \(\sqrt{\phi}\hat{\mu}_i\); under the inverse-Gaussian model it is \(\sqrt{\phi}\hat{\mu}_i^{3/2}\).

Result: If the conditional mean and variance are correctly specified, with \(\operatorname{Var}(Y_i\mid x_i)=V(\mu_i)>0\), then \(E[(Y_i-\mu_i)/\sqrt{V(\mu_i)}\mid x_i]=0\) and \(E[((Y_i-\mu_i)/\sqrt{V(\mu_i)})^2\mid x_i]=1\).

Proof. Conditional on \(x_i\), the denominator is fixed. The conditional expectation of the residual is

$$ E\left[\frac{Y_i-\mu_i}{\sqrt{V(\mu_i)}}\middle|x_i\right] = \frac{E[Y_i\mid x_i]-\mu_i}{\sqrt{V(\mu_i)}}=0. $$

For the squared residual, the definition of conditional variance gives

$$ E\left[\frac{(Y_i-\mu_i)^2}{V(\mu_i)}\middle|x_i\right] = \frac{E[(Y_i-\mu_i)^2\mid x_i]}{V(\mu_i)} = \frac{\operatorname{Var}(Y_i\mid x_i)}{V(\mu_i)} =1. $$

This identity relies on the true conditional mean and variance, not estimates fitted from the same data. Fitted Pearson residuals will vary, and their squared values need not average exactly one. \(\square\)

As a practical check, look for residuals that remain centered around zero and do not show a systematic increase or decrease in spread as fitted means change. A variance function that is too small at large means can leave large absolute standardized residuals there; one that is too large can shrink them. A visible pattern is a reason to reconsider the model, but residual behavior alone may not identify whether the problem is the family, the mean structure, or another feature of the data.

Worked Example: Comparing Pearson Residuals

Suppose two observations have fitted means \(4\) and \(16\), and observed values \(7\) and \(20\). For illustration, use gamma dispersion \(\phi=0.25\) and inverse-Gaussian dispersion \(\phi=0.05\). Under gamma, the variance at mean \(4\) is \(0.25(4^2)=4\), so the residual is \((7-4)/\sqrt{4}=1.5\). At mean \(16\), the variance is \(0.25(16^2)=64\), giving \((20-16)/\sqrt{64}=0.5\).

Under inverse-Gaussian, the variance at mean \(4\) is \(0.05(4^3)=3.2\), giving residual \(3/\sqrt{3.2}\approx1.68\). At mean \(16\), the variance is \(0.05(16^3)=204.8\), giving residual \(4/\sqrt{204.8}\approx0.28\). The same raw deviations produce different standardized residuals because the models assign different variances at those means. Two observations cannot establish which family is better; the comparison should use the full pattern of residuals and the data’s mean–variance behavior.

Common Mistakes and a Practical Choice

  • Choosing a family just because the response is positive. Both candidates have positive support. Positivity alone does not distinguish their variance functions or establish that either conditional distribution is adequate.
  • Assuming equal dispersion means equal variability. The variance includes both \(\phi\) and a different power of \(\mu\) for each family. Compare implied variances at relevant means.
  • Treating a noisy variance pattern as a verdict. Group variance estimates can fluctuate substantially. Use the pattern as evidence alongside model-based residual behavior.
  • Blaming the family for every residual trend. A trend can also signal an inadequate mean model or unaccounted-for structure. A family change cannot automatically fix those problems.

A useful sequence is to check that the response is strictly positive, compare the observed variance growth with the quadratic and cubic patterns, fit plausible candidates, and inspect whether their residuals show systematic changes in center or spread across fitted means. Prefer a family only when its implied variance behavior and residual patterns are reasonably consistent with the data and the scientific setting. The choice remains provisional when evidence is weak or competing explanations remain plausible.

Check Your Understanding

Use the definitions and comparisons in this tutorial to answer the following questions.

  1. If the mean triples and dispersion stays fixed, by what factor does the variance change under gamma? Under inverse-Gaussian?
  2. At a fixed mean, what dispersion would give an inverse-Gaussian model the same variance as a gamma model with dispersion \(\phi_G\)?
  3. Why can stable variance-to-\(\mu^3\) ratios support inverse-Gaussian variance growth without proving the inverse-Gaussian distribution is correct?
  4. What should a systematic increase in absolute Pearson residuals across fitted means prompt you to check?
  5. Why is it not valid to interpret a fitted Pearson residual as having conditional squared expectation exactly one in every finite sample?
Clinical Biostats