Reading the current lesson
Learn
Interactive·

Generalized Linear Models (GLMs)

Keep a linear predictor while using a distribution and link suited to probabilities, counts, and other outcomes.

Ordinary linear regression can predict impossible probabilities below 0 or above 1, and it does not match the changing variance of binary or count outcomes.

A generalized linear model preserves a linear combination of predictors but connects it to the outcome mean through a suitable probability distribution and link function.

Key question

How can one regression framework handle continuous, binary, and count outcomes without forcing them into the same error model?

1

Concept

What does a GLM extend?

A GLM models a transformed conditional mean with a linear predictor

Generalized linear model

g(E[Y|X]) = β₀ + β₁x₁ + … + βₖxₖ

The right side remains a linear combination. The link g converts the conditional mean—such as a probability or expected count—into a scale on which that linear predictor can operate.

Where a straight line fails

0 – 1
10

A line keeps going, so it predicts probabilities below 0 and above 1.

The link function

g(E[Y]) = Xβ
E[Y]g⁻¹

g moves the mean onto a scale where the predictors can act linearly.

A distribution per outcome

family
0 / 10,1,2…

Continuous, binary and count outcomes each need their own family.

2

Why It Matters

Why is a link function needed?

The link function maps the allowed outcome mean to the full linear-predictor scale

OutcomeCommon linkWhat it accomplishes
Continuousidentityleaves the mean on its original scale
Binarylogit or probitmaps probabilities between 0 and 1 to an unbounded scale
Countlogkeeps expected counts positive
3

How It Works

What are the components of a GLM?

Every GLM combines a random component, a systematic component, and a link

  • Random component: the outcome distribution, such as Gaussian, binomial, or Poisson.
  • Systematic component: the linear predictor Xβ.
  • Link function: the transformation connecting the conditional mean to Xβ.
  • Variance function: how outcome variance changes with its mean under the chosen family.
4

Example

How do we choose a model?

Choose the family from the outcome and the variance structure

Outcome patternCommon model
Unbounded continuous outcomeGaussian GLM / linear regression
0–1 responsebinomial logistic or probit regression
Nonnegative countPoisson or negative-binomial regression
Positive right-skewed continuous outcomeGamma GLM

Model choice is not only about the label

Check whether the implied variance, link, and residual behavior fit the data rather than choosing a family from the outcome name alone.

5

Interactive

Change the distribution and link

Change the distribution and link

Switch among outcome families and links, then observe how the same linear predictor is translated into a mean, probability, or expected count.

η = Xβ

0.80

Link

identity

Expected outcome

0.800

μ = η

What to watch

The coefficients live on the link scale. Their practical meaning changes with the distribution–link combination.

Key takeaways

  • GLMs extend linear regression to non-Gaussian outcomes.
  • The linear predictor remains Xβ, while the link connects it to the conditional mean.
  • The distribution determines the outcome and variance assumptions.
  • Interpret coefficients on the link scale or transform them back to probabilities, rates, or expected values.
Next: Logistic and probit regression