Link Functions and the Exponential Family
Why logistic regression looks the way it does: a link function bridges an unbounded linear score to a bounded or constrained outcome, and the whole family of "regression-shaped" models (logistic, Poisson, gamma) share this same recipe.
Prerequisites: Logistic Regression
A linear model predicts , a sum that can be any real number. That's fine for tomorrow's return, but not for a probability, which must sit between 0 and 1, or a count, which must be non-negative. A link function is the fix: a translator between an unrestricted linear score and an outcome that has to obey its own rules.
The analogy: a dial and the actual temperature
The linear part of the model is like a dial that spins freely from to . The room temperature it controls can't do that — it's bounded by what the heater and season allow. The thermostat translates "dial position" into "actual temperature" through a fixed curve, so however far you spin the dial, the temperature stays physically sensible. A link function plays that role between the raw linear score and the constrained quantity it stands in for.
The mechanics: linear score in, correct-shaped answer out
Write the linear part as , the linear predictor, living on . The link function connects it to the outcome's mean : . You don't model the mean directly with a straight line — you model a transform of it, chosen so the inverse transform always lands back inside the valid range. For probabilities, the standard choice is the logit link:
In plain English: whatever real number comes out, the logistic function on the right squashes it back into — that's logistic regression. For counts, the log link, , gives , guaranteed non-negative — that's Poisson regression. These outcome distributions belong to the exponential family, a shared algebraic form from which a natural "canonical" link falls out for each one.
Worked example: score to probability
A default model gives linear predictor . At leverage 2, , so . At leverage 4, , so . The linear predictor keeps growing linearly with leverage, but the link function ensures never leaves , however extreme leverage gets.
Drag the parameters above and watch how, however wide the input range, the output stays pinned between 0 and 1 — the squashing behavior a link function buys a linear model.
What this means in practice
Choosing the link function means choosing what shape of outcome you're honestly modeling: identity for something unbounded, logit for a probability, log for a count or strictly positive quantity like volume. Fitting plain linear regression to a probability or count produces predictions outside the valid range.
A link function, , lets a model keep an ordinary unbounded linear score internally while guaranteeing predictions land in the outcome's valid range — logit for probabilities, log for counts. The exponential family is the set of distributions for which such a natural link exists.
It's tempting to read the linear predictor's coefficients as if on the outcome's own scale — "leverage's coefficient is 0.8, so +1 leverage raises default probability by 0.8." It doesn't: the effect on is linear, but the effect on is curved by the logistic squashing, so the same one-unit change moves by different amounts depending on where you start.
Related concepts
Practice in interviews
Further reading
- McCullagh & Nelder, Generalized Linear Models, ch. 2
- Hastie, Tibshirani & Friedman, The Elements of Statistical Learning, ch. 4.4