core29 min studyLesson 259 in Mathematics

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

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 ηi=xiTβ\eta_i=x_i^{\mathsf T}\beta, and a one-to-one link g(μi)=ηig(\mu_i)=\eta_i 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.

f(yi;θi,ϕ)=exp⁡ ⁣{yiθi−b(θi)ϕai+ci(yi,ϕ)},μi=b′(θi),Var⁡(Yi)=ϕaib′′(θi)f(y_i;\theta_i,\phi)=\exp\!\left\{\frac{y_i\theta_i-b(\theta_i)}{\phi a_i}+c_i(y_i,\phi)\right\},\quad \mu_i=b'(\theta_i),\quad \operatorname{Var}(Y_i)=\phi a_i b''(\theta_i)
This regular exponential-dispersion representation uses a fixed support and suitable differentiability; cᵢ incorporates any known row-specific weight in the normalizing term. The GLM additionally specifies a mean link and conditional independence for a product likelihood.↔ Scroll wide equations horizontally.

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.

logit⁡(μi)=xiTβ ⟹ μi=11+e−xiTβ,log⁡E(Yi)=log⁡ti+xiTβ\operatorname{logit}(\mu_i)=x_i^{\mathsf T}\beta\ \Longrightarrow\ \mu_i=\frac1{1+e^{-x_i^{\mathsf T}\beta}},\qquad \log E(Y_i)=\log t_i+x_i^{\mathsf T}\beta
The first expression is a Bernoulli logit mean. The second is a Poisson log-mean model with known positive exposure tᵢ and an offset coefficient fixed at one.↔ Scroll wide equations horizontally.

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.

Translate a logit coefficient into odds

Consider logit⁡(p)=−0.5+2x\operatorname{logit}(p)=-0.5+2x. Calculate the probability at x=0.75 and the odds ratio when x increases from 0.75 to 1.75.

  1. At x=0.75 the linear predictor is −0.5+2(0.75)=1-0.5+2(0.75)=1. The modeled odds are e1e^1, so p=e/(1+e)≈0.73106p=e/(1+e)\approx0.73106.

  2. At x=1.75 the predictor is 33, giving odds e3e^3 and probability e3/(1+e3)≈0.95257e^3/(1+e^3)\approx0.95257.

  3. The odds ratio is e3/e1=e2≈7.3891e^3/e^1=e^2\approx7.3891. The probability increase is only about 0.2215; multiplying the original probability by the odds ratio would exceed one and use the wrong interpretation.

The result

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.

Explore the model

Interactive lab

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.

Inspect one logistic mean calculationOne inspectable sigmoid unit, σ(wx − 0.5). Playback traces the computation graph. There is no training, attention mechanism or hidden deep network. Current readings: Product · wx: 1.2; Logit · wx − 0.5: 0.7; Sigmoid output: 0.6682. All parameters are adjustable with the labeled controls below.One input. One weight. One sigmoid.x1.20× w1.20+ b0.70σ0.668output0.668w = 1.00b = −0.50σ(z) = 1 / (1 + exp(−z))
Computation graphSignal trace
Product · wx
1.2
Logit · wx − 0.5
0.7
Sigmoid output
0.6682
t = 0 s

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.

Check your understanding

In a Bernoulli GLM, what does the logit link transform?

Try it yourself

A Poisson rate model uses log⁡E(Y)=log⁡t+0.2+0.3x\log E(Y)=\log t+0.2+0.3x, 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 0.2+0.3(2)=0.80.2+0.3(2)=0.8. The expected count is 5e0.8≈11.12775e^{0.8}\approx11.1277. At exposure 10 it is 10e0.8≈22.255410e^{0.8}\approx22.2554, exactly twice as large. Under the Poisson model each count variance equals its corresponding mean; doubling exposure does not mean doubling a probability.

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.