Generalized Linear Models

A unifying framework — link function plus exponential-family distribution — that includes linear, logistic, and Poisson regression as special cases.

GLMs keep the linear score but swap the link and response distribution to match the data

Linear regression

linear score
Response
continuous
Support
any real value
Link
identity
Noise
Normal

Logistic regression

upper limitlinear score
Response
binary
Support
0 to 1 probability
Link
logit
Noise
Bernoulli

Poisson regression

linear score
Response
counts
Support
zero or positive
Link
log
Noise
Poisson
Same backbone: features become a linear score. The link turns that score into a legal mean for the response.
Definition

A Generalized Linear Model (GLM) is a recipe with three ingredients:

  1. A linear predictor η=Xβ\eta = X\beta — the same weighted sum of features used in ordinary linear regression.
  2. A link function gg that connects η\eta to the mean μ\mu of the response: g(μ)=ηg(\mu) = \eta.
  3. A choice of distribution (from the exponential family) for how the response varies around that mean.

Ordinary linear regression, logistic regression, and Poisson regression are not three unrelated techniques — they're the same model with three different choices of link function and distribution.

Spotting the pattern

Linear regression: predict a continuous value \Rightarrow identity link (g(μ)=μg(\mu) = \mu), Normal distribution.

Logistic regression: predict a probability \Rightarrow logit link, Bernoulli distribution.

Both fit η=Xβ\eta = X\beta first — they only differ in how η\eta gets turned into a prediction and how the error around that prediction is modeled.

Try it

Why can't ordinary linear regression be used directly to predict a probability (a value that must stay between 0 and 1)?

Solution

Linear regression's predictions XβX\beta can be any real number — nothing stops them from going below 0 or above 1, which makes no sense as a probability. The logit link function specifically maps the unrestricted real line to the (0, 1) interval, which is exactly why logistic regression uses it instead of the identity link.

Related concepts