Chapter 23 GLM families and use cases

As we have seen in the previous chapters, Generalised Linear Models (GLMs) extend the linear regression framework by allowing response variables with non-normal error distributions. GLMs are particularly useful in cases where the response variable exhibits properties such as boundedness, non-linearity, or non-constant variance. Each GLM family addresses specific data characteristics and includes a link function to relate the mean of the response variable (\(\mu\)) to a linear predictor (\(\eta\)).

The choice of family and link function is important for proper data modelling. Binomial families are suited for binary or proportional data, while Poisson families are ideal for count data. When variability in the data exceeds the assumptions of the specified family (e.g., overdispersion), quasi-likelihood families may be employed. This extra variation often arises from unaccounted-for heterogeneity in the data, such as omitted seasonal effects or other unmeasured variables that influence the response but are not included as predictors. In some cases, including these missing variables can reduce overdispersion and improve model fit.

Overdispersion can be diagnosed from model summaries by comparing the residual deviance to the degrees of freedom. Specifically, dividing the residual deviance by the degrees of freedom yields a ratio where values clearly greater than 1 suggest overdispersion. Ratios below about 1.5 are usually fine, ratios between about 1.5 and 2 call for caution, and ratios above 2 often indicate the need for a quasi-likelihood model, such as a quasi-Poisson or quasi-Binomial family, which introduces a dispersion parameter to account for the extra variability. This adjustment ensures that standard errors are correctly estimated, leading to more reliable hypothesis tests and confidence intervals.

This brief section summarises properties of common GLM families and gives examples of applications. It also provides mathematical details about the link and inverse link functions.


23.1 Summary Table of GLM Families

Family Name Bounds of Response Variable Link Name Link Equation Inverse Link Equation Variance Function
gaussian \((-\infty, \infty)\) Identity \(g(\mu) = \mu\) \(\mu = \eta\) constant (\(\sigma^2\))
poisson \([0, \infty)\) Log \(g(\mu) = \log(\mu)\) \(\mu = \exp(\eta)\) \(\mu\)
binomial \([0, 1]\) Logit \(g(\mu) = \log\left(\frac{\mu}{1-\mu}\right)\) \(\mu = \frac{\exp(\eta)}{1 + \exp(\eta)}\) \(\mu(1-\mu)\) (per trial)
Gamma \((0, \infty)\) Inverse \(g(\mu) = \frac{1}{\mu}\) \(\mu = \frac{1}{\eta}\) \(\mu^2\)
inverse.gaussian \((0, \infty)\) Inverse Squared \(g(\mu) = \frac{1}{\mu^2}\) \(\mu = \frac{1}{\sqrt{\eta}}\) \(\mu^3\)
quasibinomial \([0, 1]\) Logit \(g(\mu) = \log\left(\frac{\mu}{1-\mu}\right)\) \(\mu = \frac{\exp(\eta)}{1 + \exp(\eta)}\) \(\phi\,\mu(1-\mu)\)
quasipoisson \([0, \infty)\) Log \(g(\mu) = \log(\mu)\) \(\mu = \exp(\eta)\) \(\phi\,\mu\)
quasi Depends on the variance function You choose (default identity) You choose (\(\times \phi\))

This table provides a quick reference for understanding the key attributes of each GLM family, including the canonical links and the variance function, which describes how the variance of the response changes with its mean (\(\mu\)). The variance function is often the best guide to choosing a family: for example, if the variance increases in proportion to the mean, a Poisson-type model is appropriate; if the standard deviation increases in proportion to the mean (so the variance increases with \(\mu^2\)), a Gamma model may be better. In the quasi families, \(\phi\) is a dispersion parameter estimated from the data. Remember that the link function transforms the mean of the response (\(\mu\)), not the data themselves, and the inverse link converts the linear predictor (\(\eta\)) back to the scale of the mean. See below for more details and some examples.

23.2 Common GLM Families

1. Gaussian (link = “identity”)

  • Properties: Suitable for continuous response variables that are normally distributed. Gaussian data can, in theory, take any value \((-\infty, \infty)\). This is a trivial family in the sense the glm model becomes mathematically identical to the regular lm model.
  • Link function: \(g(\mu) = \mu\).
  • Inverse link: \(\mu = \eta\).
  • Variance: constant (it does not depend on the mean).
  • Examples:
    1. Plant height as a function of soil nutrient content.
    2. Fish weight relative to water temperature they grow in.

2. Poisson (link = “log”)

  • Properties: Used for count data, particularly for events occurring in a fixed space or time. The response variable must be a non-negative integer \([0, \infty)\).
  • Link function: \(g(\mu) = \log(\mu)\).
  • Inverse link: \(\mu = \exp(\eta)\).
  • Variance: equal to the mean (\(\mu\)).
  • Examples:
    1. Number of flowers produced per plant under different water regimes.
    2. Bird species counts on islands of different sizes.

3. Binomial (link = “logit”)

  • Properties: Used for binary or proportion data where the response is a probability or fraction between 0 and 1. The response variable must lie within the bounds \([0, 1]\).
  • Link function: \(g(\mu) = \log\left(\frac{\mu}{1-\mu}\right)\), where \(\mu\) is the expected probability.
  • Inverse link: \(\mu = \frac{\exp(\eta)}{1 + \exp(\eta)}\), where \(\eta = g(\mu)\) is the linear predictor.
  • Variance: \(\mu(1-\mu)\) for a single trial (largest at \(\mu = 0.5\), smallest near 0 and 1).
  • Examples:
    1. The presence or absence (0/1) of a species in different habitat types, or along an ecological gradient.

    2. Proportion of seeds (successes vs. failures) that germinate under different soil conditions.

4. Gamma (link = “inverse”)

  • Properties: Used for continuous, positive response variables with skewed distributions. The response variable must be strictly greater than 0, (i.e. no zero values) \((0, \infty)\).
  • Link function: \(g(\mu) = \frac{1}{\mu}\) (the canonical link). In practice, the log link (family = Gamma(link = "log")) is often used instead, because it guarantees positive predictions and its coefficients are easier to interpret (as multiplicative effects, like a Poisson GLM).
  • Inverse link: \(\mu = \frac{1}{\eta}\) (or \(\mu = \exp(\eta)\) with the log link).
  • Variance: \(\mu^2\), so the standard deviation increases in proportion to the mean.
  • Examples:
    1. Time to reach maturity for plants under varying light intensities.
    2. Energy expenditure of birds during migration under different conditions.

5. Inverse Gaussian (link = “1/mu^2”)

  • Properties: Suitable for strictly positive continuous data \((0, \infty)\) in which the variability increases with the mean even more steeply than for the Gamma family.
  • Link function: \(g(\mu) = \frac{1}{\mu^2}\).
  • Inverse link: \(\mu = \frac{1}{\sqrt{\eta}}\).
  • Variance: \(\mu^3\).
  • Examples:
    1. Survival times of fish in polluted versus clean waters.
    2. Distance travelled by animals during foraging in different habitats.

23.3 Quasi-family models

As described above, sometimes the variance in the data exceeds the assumptions of the specified family. In those cases, the following models are available in the glm framework.

1. Quasipoisson (link = “log”)

  • Properties: Similar to the Poisson family but for overdispersed count data. Overdispersion may arise when the variability in the count data exceeds the mean, violating the Poisson assumption that the mean equals the variance. The response variable must be non-negative integers \([0, \infty)\).
  • Link function: \(g(\mu) = \log(\mu)\).
  • Inverse link: \(\mu = \exp(\eta)\).
  • Variance: \(\phi\,\mu\), where the dispersion parameter \(\phi\) is estimated from the data (\(\phi > 1\) for overdispersed data).
  • Alternative: the negative binomial model (MASS::glm.nb, see the chapter on generalised linear models), in which the variance increases faster than the mean (\(\mu + \mu^2/\theta\)).

2. Quasibinomial (link = “logit”)

  • Properties: Similar to the binomial family but for overdispersed binary/proportion data. Overdispersion may arise when there is unaccounted-for heterogeneity in the probabilities of success across observations. The response variable must lie between \([0, 1]\).
  • Link function: \(g(\mu) = \log\left(\frac{\mu}{1-\mu}\right)\).
  • Inverse link: \(\mu = \frac{\exp(\eta)}{1 + \exp(\eta)}\).
  • Variance: \(\phi\,\mu(1-\mu)\) per trial, with \(\phi\) estimated from the data.

3. Quasi (you choose the link and the variance function)

The general quasi family lets you specify both the link function and the variance function yourself, for cases where none of the standard families describes how the variance changes with the mean. For example, glm(y ~ x, family = quasi(link = "log", variance = "mu^2")) fits a model with a log link in which the variance increases with the square of the mean (like a Gamma model), with a dispersion parameter estimated from the data. With its default settings (link = "identity", variance = "constant") it is simply the ordinary Gaussian model.

You are unlikely to need the quasi family in this course: for overdispersed counts or proportions, use quasipoisson, quasibinomial or a negative binomial model instead.