What will I learn here?
This tool shows
why a linear model (LM) is structurally wrong for certain data types
— and how a GLM with an appropriate distribution solves the problem.
- What happens when you choose the wrong likelihood?
- What is a link function — and what is it needed for?
- How do you choose the right distribution family?
The three scenarios
- Binary data (0/1): The LM can predict probabilities < 0 or
> 1. GLM with Bernoulli + logit link keeps predictions in (0,1).
- Count data (0, 1, 2, …): The LM can produce negative predictions.
GLM with Poisson + log link guarantees positive expected values.
- Positive, skewed data: The normal distribution assumption of the LM
does not fit. Gamma-GLM with log link correctly models the right skew.
Link function — briefly explained
The linear predictor η = a + b·x can take any value (−∞ to +∞).
But many outcomes have a restricted range:
Logit link (Bernoulli):
log(p/(1-p)) = η →
every η gives a p ∈ (0,1)
Log link (Poisson, Gamma):
log(λ) = η →
λ = e^η is always positive
Identity (Normal):
E[y] = η — the classical LM
Reading the AIC comparison
ΔAIC = AIC(LM) − AIC(GLM) — the larger, the worse the LM.
Rules of thumb: < 2 = barely any difference · 2–10 = moderate advantage · > 10 = LM clearly unsuitable.
Important: Both models are evaluated with the
same likelihood — a fair comparison.
Why this matters for Bayes
The choice of likelihood is just as central in Bayes as in MLE.
A Bayesian model consists of
Likelihood × Prior — if you choose the wrong
likelihood (e.g. Normal for 0/1 data), the model is structurally wrong,
regardless of how good the prior is.
Next → GLM Conditional Distributions: how GLMs
model a separate distribution for each x-value