Regression Analysis and Generalized Linear Models

⚡ Key Takeaways

Regression analysis models the conditional distribution of a response variable given predictors; Generalized Linear Models (GLMs) extend ordinary linear regression to response distributions in the exponential family via a link function relating the mean to a linear predictor. Key result: maximum likelihood estimation in a GLM reduces to Iteratively Reweighted Least Squares (IRLS), which solves the score equations efficiently. Applies wherever responses are continuous, binary, count, or otherwise non-Gaussian. Foundational work by Nelder & Wedderburn (1972); roots in Legendre, Gauss, and Galton.

💡 The Core Insight

Linear regression is "least squares applied to a Gaussian." Replace the Gaussian by any exponential-family distribution and connect its mean to a linear predictor through a smooth invertible link. The exponential family's algebra guarantees that (i) the mean and variance are determined by a single natural parameter, (ii) the log-likelihood is concave in the natural parameter, and (iii) maximum likelihood estimation becomes Newton/Fisher-scoring that is exactly weighted least squares. Thus heterogeneous data types are tamed by a single, elegant, convex machine.

Formal Statement

DefinitionThe Linear Model

Given nn observations (yi,xi)(y_i,\mathbf{x}_i) with xi∈Rp\mathbf{x}_i\in\mathbb{R}^p, the ordinary linear regression model is

1
yi=xi⊤β+εi,εiN(0,σ2),\quad y_i = \mathbf{x}_i^\top\boldsymbol\beta + \varepsilon_i,\qquad \varepsilon_i \overset{\text{iid}}{\sim}\mathcal N(0,\sigma^2),

equivalently in matrix form y=Xβ+ε\mathbf{y} = \mathbf{X}\boldsymbol\beta + \boldsymbol\varepsilon, where X∈Rn×p\mathbf{X}\in\mathbb{R}^{n\times p} is the design matrix, β∈Rp\boldsymbol\beta\in\mathbb{R}^p the coefficient vector, σ2\sigma^2 the error variance, and ε∼N(0,σ2In)\boldsymbol\varepsilon\sim\mathcal N(\mathbf 0,\sigma^2\mathbf I_n). Derivation hint: stack the scalar equations row-wise; the independence of the εi\varepsilon_i makes the covariance diagonal.

DefinitionThe Exponential Family

A distribution belongs to the (one-parameter) exponential dispersion family if its density/mass can be written

2
f(y;θ,ϕ)=exp⁡ ⁣{yθ−b(θ)a(ϕ)+c(y,ϕ)},\quad f(y;\theta,\phi)=\exp\!\left\{\frac{y\theta-b(\theta)}{a(\phi)}+c(y,\phi)\right\},

where θ\theta is the natural (canonical) parameter, ϕ>0\phi>0 the dispersion parameter, b(⋅)b(\cdot) the cumulant function (a smooth convex function), a(ϕ)a(\phi) typically ϕ/w\phi/w for known prior weight ww, and c(y,ϕ)c(y,\phi) a normalizing term independent of θ\theta. Derivation hint: write Gaussian/Bernoulli/Poisson densities in exponential form and read off θ\theta and b(θ)b(\theta).

TheoremMean and Variance from the Cumulant Function

For any member of the exponential dispersion family [2],

3
μ≡E[Y]=b′(θ),Var⁡(Y)=a(ϕ) b′′(θ)=a(ϕ) V(μ),\quad \mu \equiv E[Y]=b'(\theta),\qquad \operatorname{Var}(Y)=a(\phi)\,b''(\theta)=a(\phi)\,V(\mu),

where V(μ)=b′′(θ(μ))V(\mu)=b''(\theta(\mu)) is the variance function, expressing the variance as a function of the mean. Derivation hint: differentiate the identity ∫f dy=1\int f\,dy=1 twice with respect to θ\theta and use E[∂θlog⁡f]=0E[\partial_\theta \log f]=0 and Var⁡(∂θlog⁡f)=−E[∂θ2log⁡f]\operatorname{Var}(\partial_\theta\log f)=-E[\partial_\theta^2\log f].

DefinitionGeneralized Linear Model

A GLM consists of three components: 1. Random component: YiY_i independent with density [2] and means μi\mu_i. 2. Systematic component: a linear predictor ηi=xi⊤β\eta_i=\mathbf{x}_i^\top\boldsymbol\beta. 3. Link function: a monotone, twice-differentiable gg with

4
g(μi)=ηi=xi⊤β,μi=g−1(ηi).\quad g(\mu_i)=\eta_i=\mathbf{x}_i^\top\boldsymbol\beta,\qquad \mu_i=g^{-1}(\eta_i).

The canonical link is g=(b′)−1g=( b')^{-1}, which makes θi=ηi\theta_i=\eta_i directly. For Gaussian, g(μ)=μg(\mu)=\mu (identity); for Bernoulli, g(μ)=log⁡μ1−μg(\mu)=\log\frac{\mu}{1-\mu} (logit); for Poisson, g(μ)=log⁡μg(\mu)=\log\mu. Derivation hint: set θ=η\theta=\eta and invert [3] μ=b′(θ)\mu=b'(\theta) to obtain g=(b′)−1g=(b')^{-1}.

TheoremScore Equations and Fisher Information

The log-likelihood of a GLM yields score (gradient) equations

5
U(β)=∑i=1n(yi−μi)a(ϕ) V(μi) ∂μi∂ηi xi=0,\quad U(\boldsymbol\beta)=\sum_{i=1}^n \frac{(y_i-\mu_i)}{a(\phi)\,V(\mu_i)}\,\frac{\partial\mu_i}{\partial\eta_i}\,\mathbf{x}_i = \mathbf 0,

and the expected (Fisher) information matrix is

6
I(β)=X⊤WX,Wii=1a(ϕ) V(μi)(∂μi∂ηi)2.\quad \mathcal I(\boldsymbol\beta)=\mathbf X^\top\mathbf W\mathbf X,\qquad W_{ii}=\frac{1}{a(\phi)\,V(\mu_i)}\left(\frac{\partial\mu_i}{\partial\eta_i}\right)^2.

Derivation hint: apply the chain rule ∂ℓ/∂βj=∑i(∂ℓi/∂θi)(∂θi/∂μi)(∂μi/∂ηi)(∂ηi/∂βj)\partial\ell/\partial\beta_j=\sum_i (\partial\ell_i/\partial\theta_i)(\partial\theta_i/\partial\mu_i)(\partial\mu_i/\partial\eta_i)(\partial\eta_i/\partial\beta_j) and use ∂ℓi/∂θi=(yi−μi)/a(ϕ)\partial\ell_i/\partial\theta_i=(y_i-\mu_i)/a(\phi).

Why It Holds / Derivation

ProofMaximum Likelihood is Iteratively Reweighted Least Squares

We derive Fisher scoring for [5] and show it equals weighted least squares. 1. Log-likelihood. From [2], the contribution of observation ii is

7
ℓi=yiθi−b(θi)a(ϕ)+c(yi,ϕ).\quad \ell_i = \frac{y_i\theta_i-b(\theta_i)}{a(\phi)}+c(y_i,\phi).

Derivation hint: take the logarithm of the exponential-family density. 2. Score per observation. Differentiating with the chain rule and using μi=b′(θi)\mu_i=b'(\theta_i), V(μi)=b′′(θi)=∂μi/∂θiV(\mu_i)=b''(\theta_i)=\partial\mu_i/\partial\theta_i,

8
∂ℓi∂βj=yi−μia(ϕ)V(μi) ∂μi∂ηi xij.\quad \frac{\partial\ell_i}{\partial\beta_j}=\frac{y_i-\mu_i}{a(\phi)V(\mu_i)}\,\frac{\partial\mu_i}{\partial\eta_i}\,x_{ij}.

Derivation hint: ∂θi/∂μi=1/V(μi)\partial\theta_i/\partial\mu_i = 1/V(\mu_i) since μ=b′(θ)\mu=b'(\theta). 3. Newton step with expected Hessian. Fisher scoring replaces the observed Hessian by −I-\mathcal I. The update is

9
β(t+1)=β(t)+I(β(t))−1U(β(t)).\quad \boldsymbol\beta^{(t+1)} = \boldsymbol\beta^{(t)} + \mathcal I(\boldsymbol\beta^{(t)})^{-1}U(\boldsymbol\beta^{(t)}).

Derivation hint: Newton–Raphson on the score, swapping observed for expected information. 4. Working response. Define the adjusted dependent variable

10
zi=ηi+(yi−μi) ∂ηi∂μi.\quad z_i = \eta_i + (y_i-\mu_i)\,\frac{\partial\eta_i}{\partial\mu_i}.

Derivation hint: linearize g(yi)g(y_i) about μi\mu_i: g(yi)≈g(μi)+(yi−μi)g′(μi)g(y_i)\approx g(\mu_i)+(y_i-\mu_i)g'(\mu_i). 5. IRLS form. Substituting [6] and [10] into [9] gives

11
β(t+1)=(X⊤WX)−1X⊤W z,\quad \boldsymbol\beta^{(t+1)}=\left(\mathbf X^\top\mathbf W\mathbf X\right)^{-1}\mathbf X^\top\mathbf W\,\mathbf z,

which is exactly the weighted least squares solution regressing the working response z\mathbf z on X\mathbf X with weights W\mathbf W. Iterating until convergence yields the MLE β^\hat{\boldsymbol\beta}. Derivation hint: collect U=X⊤WD−1(y−μ)U=\mathbf X^\top\mathbf W \mathbf D^{-1}(\mathbf y-\boldsymbol\mu) with D=diag(∂μi/∂ηi)\mathbf D=\mathrm{diag}(\partial\mu_i/\partial\eta_i), then absorb terms so I−1U+β=(X⊤WX)−1X⊤Wz\mathcal I^{-1}U + \boldsymbol\beta = (\mathbf X^\top\mathbf W\mathbf X)^{-1}\mathbf X^\top\mathbf W\mathbf z.

∎
mathematician · John Nelder & Robert Wedderburn | 1924–2010 / 1947–1975

John Nelder, a British statistician at Rothamsted Experimental Station, and Robert Wedderburn, his young collaborator, published "Generalized Linear Models" in the Journal of the Royal Statistical Society in 1972. Their insight was to recognize that linear regression, logistic regression, log-linear models, and probit analysis — previously taught as separate techniques — were all instances of one unifying structure: an exponential-family response and a link function, fitted by a single algorithm. Wedderburn further introduced quasi-likelihood (1974), freeing estimation from full distributional assumptions by requiring only a mean–variance relationship. Tragically, Wedderburn died at age 28 from anaphylaxis; Nelder went on to develop the GLIM software that made GLMs computationally accessible and championed the framework for decades.

Building Intuition

🧠 Intuition

Picture ordinary least squares as fitting a flat plane to a cloud of points, where every point pulls equally hard (constant variance). A GLM says: not all points should pull equally — points where the response is intrinsically more variable should pull less. The weights WiiW_{ii} encode "how much to trust this observation," and they depend on the current fitted mean. The link function is a change of scale: for counts you fit on a log scale (so the prediction can never go negative); for probabilities you fit on a logit scale (so predictions stay in [0,1][0,1]). IRLS then alternates: "given current beliefs about the means, recompute trust weights and a linearized target; refit by weighted least squares; repeat." It is least squares wearing different costumes for different data types.

Worked Examples

ExampleLogistic Regression: Probability of Defect

Given. An engineer tests n=4n=4 components at temperatures x=(10,20,30,40)x=(10,20,30,40) °C with binary outcomes "defect" y=(0,0,1,1)y=(0,0,1,1). We fit logit⁡(μi)=β0+β1xi\operatorname{logit}(\mu_i)=\beta_0+\beta_1 x_i, where μi=P(Yi=1)\mu_i=P(Y_i=1). Variance function V(μ)=μ(1−μ)V(\mu)=\mu(1-\mu), canonical logit link, dispersion ϕ=1\phi=1.

Steps. 1. Initialize β(0)=( −2.5,  0.1 )⊤\boldsymbol\beta^{(0)}=(\,-2.5,\;0.1\,)^\top. Compute ηi=β0+β1xi=(−1.5,−0.5,0.5,1.5)\eta_i=\beta_0+\beta_1x_i=(-1.5,-0.5,0.5,1.5). 2. Inverse link μi=1/(1+e−ηi)=(0.182,0.378,0.622,0.818)\mu_i=1/(1+e^{-\eta_i})=(0.182,0.378,0.622,0.818). 3. Weights Wii=μi(1−μi)=(0.149,0.235,0.235,0.149)W_{ii}=\mu_i(1-\mu_i)=(0.149,0.235,0.235,0.149) (since for canonical link ∂μ/∂η=V(μ)\partial\mu/\partial\eta=V(\mu), so W=VW=V). 4. Working response zi=ηi+(yi−μi)/Wiiz_i=\eta_i+(y_i-\mu_i)/W_{ii}: z=(−1.5−0.182/0.149,  −0.5−0.378/0.235,  0.5+0.378/0.235,  1.5+0.182/0.149)=(−2.72,−2.11,2.11,2.72)z=(-1.5-0.182/0.149,\; -0.5-0.378/0.235,\;0.5+0.378/0.235,\;1.5+0.182/0.149)=(-2.72,-2.11,2.11,2.72). 5. Solve β(1)=(X⊤WX)−1X⊤Wz\boldsymbol\beta^{(1)}=(\mathbf X^\top\mathbf W\mathbf X)^{-1}\mathbf X^\top\mathbf W\mathbf z. By the data's symmetry the estimate centers at x=25x=25; one iteration moves toward β^1≈0.13\hat\beta_1\approx0.13, β^0≈−3.3\hat\beta_0\approx-3.3, and IRLS converges within ~6 iterations.

Answer.

β^0≈−3.3,β^1≈0.13 per °C;P^(defect∣25∘)=0.5\boxed{\hat\beta_0\approx -3.3,\quad \hat\beta_1\approx 0.13\ \text{per °C};\quad \hat P(\text{defect}\mid 25^\circ)=0.5}
ExamplePoisson Regression: Insurance Claim Counts

Given. Policyholders' claim counts yy with exposure (years) tt. Model log⁡μi=log⁡ti+β0+β1ai\log\mu_i=\log t_i+\beta_0+\beta_1 a_i where aia_i is a risk indicator and log⁡ti\log t_i is an offset. Data: (a,t,y)=(0,2,1),(0,1,0),(1,3,4),(1,2,3)(a,t,y)=(0,2,1),(0,1,0),(1,3,4),(1,2,3). Variance function V(μ)=μV(\mu)=\mu, log link, ϕ=1\phi=1.

Steps. 1. Rate λi=μi/ti=exp⁡(β0+β1ai)\lambda_i=\mu_i/t_i=\exp(\beta_0+\beta_1 a_i). Total exposure-by-group: low-risk t=3t=3, claims =1=1; high-risk t=5t=5, claims =7=7. 2. For Poisson with log link and a single binary covariate, the MLE matches observed rates: λ^low=1/3=0.333\hat\lambda_{\text{low}}=1/3=0.333, λ^high=7/5=1.40\hat\lambda_{\text{high}}=7/5=1.40. 3. Recover coefficients: β^0=log⁡(0.333)=−1.099\hat\beta_0=\log(0.333)=-1.099; β^0+β^1=log⁡(1.40)=0.336⇒β^1=1.435\hat\beta_0+\hat\beta_1=\log(1.40)=0.336\Rightarrow\hat\beta_1=1.435. 4. Rate ratio =eβ^1=e1.435=4.20=e^{\hat\beta_1}=e^{1.435}=4.20: high-risk policyholders file claims at 4.2× the rate.

Answer.

β^0=−1.10,β^1=1.44,rate ratio=4.20 (claims/year)\boxed{\hat\beta_0=-1.10,\quad \hat\beta_1=1.44,\quad \text{rate ratio}=4.20\ \text{(claims/year)}}

Common Misconceptions

⚠️ Linearity is in the parameters, not the covariates

"Linear" in linear and generalized linear model refers to linearity in β\boldsymbol\beta, not in x\mathbf x. You may include x2x^2, log⁡x\log x, splines, or interactions and remain within the (G)LM framework. Conversely, a model that is nonlinear in the parameters (e.g., μ=β0eβ1x\mu=\beta_0 e^{\beta_1 x}) is not a GLM even though it has an exponential shape — unless you can recast it through a valid link.

⚠️ Do not confuse the link scale with the response scale

Coefficients are interpreted on the link scale. In Poisson log-link regression, β1\beta_1 is a log rate ratio; in logistic regression, β1\beta_1 is a log odds ratio — neither is a change in probability or in count. Predictions must be back-transformed via g−1g^{-1}, and because g−1g^{-1} is nonlinear, E[g−1(η)]≠g−1(E[η])E[g^{-1}(\eta)]\neq g^{-1}(E[\eta]) in general (Jensen's inequality).

CounterexamplePerfect separation breaks logistic MLE

If a covariate perfectly separates the two classes — every yi=1y_i=1 has xi>cx_i>c and every yi=0y_i=0 has xi<cx_i<c — the likelihood is monotone increasing as β^1→∞\hat\beta_1\to\infty. The MLE does not exist (it diverges), even though IRLS appears to "converge" to huge coefficients with enormous standard errors. The fitted probabilities approach 0/1 and Wald inference becomes meaningless. Remedies: Firth's penalized likelihood, Bayesian priors, or exact logistic regression. This shows that the existence of a finite MLE is not guaranteed in GLMs, unlike in full-rank Gaussian OLS.

Connections

connection

GLMs sit at a crossroads of statistics. They generalize the Ordinary Least Squares linear model and are themselves special cases of broader frameworks. The Exponential Family supplies their probabilistic backbone, and Maximum Likelihood Estimation supplies their inferential engine; the IRLS algorithm is just Newton–Raphson Method / Fisher scoring in disguise. When the dispersion or correlation structure is richer, GLMs extend to Generalized Estimating Equations (for correlated data) and Generalized Linear Mixed Models (with random effects). Wedderburn's Quasi-Likelihood drops the full distributional assumption, keeping only the mean–variance link. Regularized variants connect to Ridge Regression and Lasso Regression, and the logistic GLM is precisely the single-layer building block of Neural Networks. Inference relies on the Wald Test, Likelihood Ratio Test, and the Deviance goodness-of-fit measure.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1805–1809 — Legendre publishes the method of least squares; Gauss claims earlier use and ties it to the normal error law, founding linear regression.
- 1821–1823 — Gauss states the Gauss–Markov optimality of least squares (BLUE under uncorrelated, equal-variance errors).
- 1886 — Francis Galton coins "regression toward mediocrity" studying heredity of stature, giving regression its name.
- 1922 — R. A. Fisher formalizes maximum likelihood and the concept of statistical information.
- 1934–1944 — Bliss develops probit analysis for bioassay; Berkson (1944) introduces the logit alternative.
- 1972 — Nelder & Wedderburn unify these strands in "Generalized Linear Models," defining the link/random/systematic triad and IRLS.
- 1974 — Wedderburn introduces quasi-likelihood, requiring only a mean–variance relationship.
- 1983/1989 — McCullagh & Nelder's monograph Generalized Linear Models becomes the definitive reference; GLIM software popularizes the methods.
- 1986 — Liang & Zeger introduce Generalized Estimating Equations, extending GLMs to longitudinal/correlated data.

Subtleties & Limits

open-problem

Several issues remain active or delicate. Existence and uniqueness of the MLE can fail under separation or sparse data; penalized and Bayesian regularization are still being refined for high-dimensional GLMs (p≫np\gg n), where classical asymptotics break down and even the bias of the MLE behaves non-classically (Sur & Candès, 2019). Dispersion modeling — when ϕ\phi itself depends on covariates — pushes beyond standard GLMs into double GLMs and distributional regression (GAMLSS). Misspecified mean–variance links undermine standard errors; sandwich/robust variance estimators help but lose efficiency. Causal interpretation of GLM coefficients requires assumptions (no confounding, correct functional form) far stronger than the model itself supplies, a recurring source of error in applied work. Finally, inference after model selection (choosing covariates then testing them) invalidates naive p-values; post-selection inference for GLMs is an ongoing research frontier.

See Also

Ordinary Least Squares · Exponential Family · Maximum Likelihood Estimation · Logistic Regression · Poisson Regression · Deviance · Quasi-Likelihood · Generalized Linear Mixed Models · Generalized Additive Models · Ridge Regression · Lasso Regression · Newton–Raphson Method