Generalized linear models and link functions
Connect response distributions, linear predictors, and mean links without confusing a transformed mean with a transformed observation.
On this page
The question for today
What you’ll understand
- Identify the response family, linear predictor, and link in a GLM.
- Interpret logistic coefficients through odds and Poisson offsets through exposure.
- State why fitting and inference differ from ordinary Gaussian least squares.
A straight-line conditional mean can predict negative counts or probabilities larger than one. Generalized linear models retain a linear combination of predictors while linking it to an appropriate response mean and distribution. The response family controls the mean–variance relation, and the link controls how predictors change the mean. This separation is useful for binary outcomes and counts, but choosing a familiar link does not establish independence, correct dispersion, or adequate mean structure. Those remain assumptions to examine in the application.
Three ingredients define the model
A basic GLM specifies conditionally independent responses from an exponential dispersion family, a linear predictor , and a one-to-one link for the conditional mean μᵢ. A common density or mass representation uses natural parameter θᵢ, cumulant function b, dispersion φ, and known positive scaling weights aᵢ. The base-measure term may also depend on that known row weight. Differentiating the cumulant gives the mean and variance. Merely specifying a nonlinear mean curve without a response distribution is not the complete likelihood model.
A canonical link equates the linear predictor with the natural parameter. For Bernoulli outcomes this produces the logit link, while Poisson counts use the logarithm. Other links are possible when their domains are compatible with the mean. The link acts on the conditional mean, not on each observed response: taking a logarithm of a zero count or a logit of an observed zero is neither required nor a valid description of GLM fitting.
Log odds and exposure have precise interpretations
In logistic regression, the mean is a Bernoulli success probability. Its odds are the probability divided by one minus the probability, and its log odds are linear in the predictors. Increasing one predictor by one unit while holding the others fixed multiplies the modeled odds by the exponential of its coefficient. It does not add a constant to the probability: the same coefficient produces different probability changes at different starting probabilities. Conditional association also does not establish a causal intervention effect.
For a Poisson count, the variance equals the mean under the model. A log link makes the mean positive. If observations have different known exposure durations, a log-exposure offset with coefficient fixed at one models a rate rather than conflating duration with risk. Doubling exposure then doubles the expected count at fixed rate. Overdispersion, clustering, or excess zeros can contradict the simple Poisson distribution even when a log-linked mean remains useful; changing uncertainty or the response family requires a stated alternative model.
Fitting does not preserve exact Gaussian pivots
Likelihood score equations for a GLM are generally nonlinear in β and are often solved by iteratively reweighted least squares. The working response and weights change with the current mean estimate; they are computational devices, not newly observed independent Gaussian data. A design can have full column rank while logistic likelihood still lacks a finite maximizer, as occurs under complete separation. Convergence messages, coefficient magnitudes, and the data geometry deserve inspection rather than assuming an invertible design settles existence.
Wald, score, and likelihood-ratio comparisons usually rely on large-sample regularity rather than the exact regression t and F distributions. Small samples, rare events, separation, estimated dispersion, and response-driven selection can undermine routine approximations. Examine calibration, residual patterns appropriate to the response family, and validation on the target population. A fitted probability curve can be smooth and plausible while being systematically wrong; the response family, independence structure, link, and sampling process all contribute to the inferential claim.
Work it through
Translate a logit coefficient into odds
Consider . Calculate the probability at x=0.75 and the odds ratio when x increases from 0.75 to 1.75.
At x=0.75 the linear predictor is . The modeled odds are , so .
At x=1.75 the predictor is , giving odds and probability .
The odds ratio is . The probability increase is only about 0.2215; multiplying the original probability by the odds ratio would exceed one and use the wrong interpretation.
A one-unit predictor increase multiplies odds by e² in this model. It changes probability through the inverse link rather than by a fixed additive or multiplicative probability effect.
The living notebook
Explore the model
Interactive lab · network
Inspect one logistic mean calculation
Pause and Reset; set Input x to 0.75 and Weight w to 2. Predict σ(1)≈0.73106 because the graph fixes its intercept at −0.5. Inspect the output, then use a fresh Reset with x=1.75 and w=2 and predict σ(3)≈0.95257. The single sigmoid graph evaluates a specified mean; it neither fits coefficients nor samples Bernoulli observations or tests independence.
- Product · wx
- 1.2
- Logit · wx − 0.5
- 0.7
- Sigmoid output
- 0.6682
One inspectable sigmoid unit, σ(wx − 0.5). Playback traces the computation graph. There is no training, attention mechanism or hidden deep network. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThe inverse link converts a linear predictor into a legal mean, while the response distribution supplies a separate sampling model.
Pause & reason
Check your understanding
Your turn
Try it yourself
A Poisson rate model uses , with known exposure t>0. Find the expected count at x=2, t=5, and explain the change if exposure doubles while x remains fixed.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Combine the ordinary linear predictor first, then exponentiate the exposure offset separately.
Compare with the solution
The rate predictor is . The expected count is . At exposure 10 it is , exactly twice as large. Under the Poisson model each count variance equals its corresponding mean; doubling exposure does not mean doubling a probability.
Keep the idea
Take it with you
- A GLM combines a response family, linear predictor, and mean link.
- Logit coefficients multiply odds, while log-exposure offsets scale expected counts.
- Iterative fitting and asymptotic inference do not inherit exact Gaussian t tests.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.