Gamma Regression (GLM)

Statistics
Introduced by
McCullagh & Nelder (GLM framework)
Year
1989
Type
Generalized linear model

What does it do?

Gamma regression is a generalized linear model that uses the gamma distribution to model a positive, right-skewed continuous outcome.

It is one of the models presented within the generalized linear model framework, as systematised in McCullagh and Nelder (1989), and is an alternative to ordinary linear regression for variables such as health-care costs, durations, and income.

The intuition behind the method

Many real-world quantities, like costs or waiting times, are always positive and bunch up at small values with a long tail of large ones. Forcing a straight line through such data can predict impossible negative values and misjudge the spread. Gamma regression instead assumes the outcome follows a gamma distribution whose mean is linked to the predictors, so it respects the positivity and the way the variability grows with the size of the value.

History

Gamma regression is one of the models presented within the generalized linear model framework, as systematised in McCullagh and Nelder, Generalized Linear Models (1989). That framework treats a broad class of distributions, including the gamma, under a common structure of a linear predictor, a link function, and maximum-likelihood estimation by iteratively reweighted least squares.

When to use it

Use gamma regression when the outcome is strictly positive (greater than zero), right-skewed, and its variability appears to grow with its mean, so that the coefficient of variation is roughly constant (variance proportional to the square of the mean). It is a reasonable choice for skewed continuous quantities such as costs, durations, and income, where ordinary linear regression assumes constant variance and can predict negative values. Check the variance pattern in your data before relying on the model, because the fit assumes it. Do not use it when the outcome can be zero or negative, since the gamma likelihood is undefined there; for count outcomes, Poisson or negative binomial regression is the relevant family.

Limitations and considerations

  • Requires a strictly positive outcome; observations equal to zero cannot be modelled directly.
  • Assumes the variance is proportional to the square of the mean (constant coefficient of variation); a different variance pattern misspecifies the model.
  • Estimated by maximum likelihood with no closed form, so it relies on iterative fitting; with small samples, the iterative estimates and the standard errors that depend on them may be less reliable.
  • Assumes independent observations; clustered or repeated measurements need methods that account for the correlation.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Naturally models positive, right-skewed continuous outcomes without log-transforming the response.
  • The log link gives multiplicative, interpretable effects and keeps all fitted means positive.
  • Accommodates a variance that scales with the square of the mean, a pattern under which ordinary least squares, which assumes constant variance, is a poor fit.

Applications

  • Modelling health-care costs and other expenditure data that are positive and heavily right-skewed.
  • Analysing duration or time-to-event measurements that must remain positive.
  • Studying income distributions and similar skewed continuous economic variables.

How it works

How it works

1

The outcome y is assumed to follow a gamma distribution with mean μ and shape parameter θ (equivalently, dispersion φ = 1/θ). The expected value is connected to a linear combination of the predictors through a link function. The log link is usually preferred, so log(E[y|X]) = Xβ; this keeps fitted means positive and lets each coefficient act multiplicatively on the outcome. Reading the result: under the log link, exp(β_j) is the ratio of expected outcomes for a one-unit increase in x_j, holding the other predictors fixed. It can be reported as a percentage change, (exp(β_j) − 1) × 100.

Formula
\log\big(E[y\mid X]\big) = X\beta, \quad y \sim \mathrm{Gamma}
2

The coefficients β are estimated by maximum likelihood, choosing the values that make the observed positive outcomes most probable under the gamma model. The gamma density has a second parameter, the shape θ (or dispersion φ = 1/θ), which is a nuisance parameter in the sense that it does not affect the mean. It is estimated alongside β, or, as is common in GLM software, afterwards from the residuals. There is no closed-form solution for β, so the fit is found by iteratively reweighted least squares (IRLS).

Formula
(\hat{\beta},\hat{\theta}) = \arg\max_{\beta,\theta} \sum_i \log\!\left[ \frac{(\theta/\mu_i)^{\theta}\, y_i^{\theta-1} e^{-\theta y_i/\mu_i}}{\Gamma(\theta)} \right], \quad \mu_i = \exp(x_i^{\top}\beta)

Common pitfalls

  • Applying it to data containing zeros or negative values, where the gamma likelihood is undefined.
  • Defaulting to the canonical inverse link without checking; the log link is usually the more interpretable choice and keeps fitted means positive, though the link should be justified.
  • Overlooking that the variance assumption (variance proportional to the mean squared) may not match the data, which distorts standard errors. Check it by plotting residual spread (for example squared residuals) against fitted means, where roughly quadratic growth is expected, and by comparing the Pearson chi-square or residual deviance with its degrees of freedom. If the variance assumption is doubtful, robust (sandwich) standard errors can be used.
  • Using it for count outcomes; those call for Poisson or negative binomial regression, which are listed as related models.

Frequently asked questions

When should I prefer gamma regression over ordinary linear regression?

When the outcome is strictly positive and right-skewed and its variability grows with its mean — typical of costs, durations, and income. Ordinary regression assumes constant variance and can predict negative values, which gamma regression avoids.

Which link function should I use?

The log link is usually preferred because it keeps fitted means positive and makes coefficients act multiplicatively on the outcome. The inverse link is the canonical link for the gamma family but is often harder to interpret.

How do I interpret a coefficient?

With the log link, exp(β_j) is the ratio of expected outcomes for a one-unit increase in x_j, holding other predictors fixed. The percentage change is (exp(β_j) − 1) × 100.

Can gamma regression handle zeros in the outcome?

No. The gamma distribution is defined only for strictly positive values, so zeros or negative values cannot be modelled directly. Alternatives such as two-part (hurdle) models or Tweedie models are options to consider.

How are the coefficients estimated?

By maximum likelihood. Because there is no closed-form solution, the estimates are obtained iteratively using iteratively reweighted least squares (IRLS), the standard fitting algorithm for generalized linear models.

Related methods

Sources

  1. McCullagh, P. & Nelder, J. A. (1989). Generalized Linear Models (2nd ed.). Chapman and Hall.

    Open DOI reference
  2. Econometric Analysis, 7th Edition, p. 611