STATISTICS GRADUATE LEVEL • LINEAR MODELS AND GLMS

Logistic Regression

Modeling binary outcomes through the lens of generalized linear models and maximum likelihood estimation.

Historical Context & Motivation

The need for logistic regression arose from a fundamental limitation of ordinary least squares: when the response variable is binary—taking values 0 or 1—linear regression can produce predicted probabilities outside the [0, 1] interval, violating the axioms of probability. Researchers across biostatistics, epidemiology, and the social sciences required a principled framework that would respect the bounded nature of probabilities while still permitting inference about the effects of predictor variables. The logistic function, with its elegant S-shaped curve mapping the real line onto (0, 1), provided the mathematical foundation for such a model. Its development spans nearly two centuries, from purely mathematical curiosity to one of the most widely applied statistical methods in modern science.

1838
Verhulst's Logistic Curve
Pierre-François Verhulst introduced the logistic function to model self-limiting population growth, providing the sigmoid curve that would later become central to binary classification models.
1944
Berkson's Logit Model
Joseph Berkson coined the term logit and proposed using the log-odds transformation as a link function for bioassay data, establishing the modern logistic regression framework.
1958
Cox's Formalization
David Cox published a rigorous statistical treatment of binary regression, framing logistic regression within the theory of maximum likelihood estimation and establishing inferential procedures for model parameters.
1972
Nelder & Wedderburn's GLM Framework
The introduction of generalized linear models unified logistic regression with Poisson regression, gamma regression, and other models under a single theoretical umbrella based on the exponential family.
1980s–Present
Computational Expansion
Advances in computing enabled iteratively reweighted least squares (IRLS) algorithms, making logistic regression standard in software packages such as R, SAS, and Python's scikit-learn, and extending it to regularized and multinomial variants.

The central question that logistic regression addresses is deceptively simple: how can we model the probability of a binary event as a function of one or more predictors, while ensuring that predicted probabilities remain valid and that the relationship between predictors and the log-odds is interpretable? The answer lies in combining the logit link function with maximum likelihood estimation, a pairing that gives logistic regression both its flexibility and its inferential power.

Core Principles & Definitions

Logistic regression is a member of the generalized linear model (GLM) family. To understand its architecture, one must appreciate three structural components that define every GLM: the random component specifying the distribution of the response, the systematic component forming a linear predictor from the covariates, and the link function connecting the two. In logistic regression these components take on specific, well-motivated forms that together ensure the model respects the constraints of probability while remaining tractable for estimation and inference.

1

Random Component

The response variable Y follows a Bernoulli distribution (or Binomial for grouped data), with P(Y = 1 | x) = π(x). This is a member of the exponential family, which guarantees desirable properties for MLE.
2

Systematic Component

The linear predictor η = β₀ + β₁x₁ + β₂x₂ + ⋯ + βₚxₚ combines covariates in an additive fashion on the log-odds scale, preserving the interpretability of each coefficient.
3

Link Function (Logit)

The logit link g(π) = log(π / (1 − π)) maps probabilities in (0, 1) to the entire real line (−∞, +∞), ensuring that the linear predictor is unconstrained. It is the canonical link for the Bernoulli family.
4

Odds & Odds Ratios

The odds π/(1−π) express the likelihood of an event relative to its complement. Exponentiating a coefficient eᵝʲ yields the multiplicative change in odds for a one-unit increase in xⱼ, holding other covariates fixed.
5

Maximum Likelihood Estimation

Parameters are estimated by maximizing the log-likelihood function. No closed-form solution exists, so iterative algorithms—typically IRLS or Newton–Raphson—are employed, converging to the global maximum of the concave likelihood surface.
KEY TAKEAWAY
Think of the logit link as a "lens" that re-focuses the probability scale. Just as a logarithmic amplifier in signal processing stretches small signals and compresses large ones, the logit transformation stretches probabilities near 0 and 1 while compressing those near 0.5. This creates a scale—the log-odds—on which linear relationships are natural and additive, much like using a log scale for decibels makes multiplicative signal ratios additive.

The Sigmoid Curve & Log-Odds Mapping

The defining visual signature of logistic regression is the sigmoid (S-shaped) curve that maps any real-valued linear predictor η to a probability π ∈ (0, 1). The diagram below illustrates two complementary perspectives: on the left, the inverse logit (logistic) function showing how π varies with η; on the right, the logit function showing how log-odds vary with π. Understanding both views is essential for interpreting model output.

Left panel: the inverse logit (logistic function) maps the linear predictor η ∈ (−∞, +∞) to probabilities π ∈ (0, 1). The inflection point at η = 0 corresponds to π = 0.5. Right panel: the logit function is the inverse mapping, transforming probabilities to log-odds. It is monotonically increasing and symmetric about (0.5, 0).

Several features of the sigmoid deserve attention. First, the curve is asymptotic at π = 0 and π = 1—predicted probabilities approach but never reach these boundaries, which is appropriate because perfect certainty is rarely justified by finite data. Second, the slope is steepest at η = 0 (where π = 0.5), meaning the model is most sensitive to changes in the predictors when the outcome is most uncertain. Third, the symmetry of the logistic function about its midpoint ensures that log-odds of equal magnitude but opposite sign yield complementary probabilities: if logit(π) = 2 gives π ≈ 0.88, then logit(π) = −2 gives π ≈ 0.12. This elegant property simplifies interpretation and connects directly to the concept of odds ratios.

Mathematical Framework

The mathematical formulation of logistic regression begins with the assumption that each observation Yᵢ is an independent Bernoulli random variable with success probability πᵢ that depends on a vector of covariates xᵢ. The model links πᵢ to the linear predictor through the logit function, and parameters are estimated by maximizing the resulting likelihood. We develop each component below.

LOGISTIC REGRESSION MODEL
logit(πᵢ) = log(πᵢ / (1 − πᵢ)) = xᵢᵀβ = β₀ + β₁xᵢ₁ + ⋯ + βₚxᵢₚ
πᵢ = P(Yᵢ = 1 | xᵢ) is the conditional probability of success. β = (β₀, β₁, …, βₚ)ᵀ is the parameter vector. The inverse relationship gives πᵢ = exp(xᵢᵀβ) / (1 + exp(xᵢᵀβ)).
LOG-LIKELIHOOD FUNCTION
ℓ(β) = Σᵢ₌₁ⁿ [ yᵢ log(πᵢ) + (1 − yᵢ) log(1 − πᵢ) ] = Σᵢ₌₁ⁿ [ yᵢ xᵢᵀβ − log(1 + exp(xᵢᵀβ)) ]
The second form is obtained by substituting πᵢ = expit(xᵢᵀβ). This function is globally concave in β, guaranteeing a unique maximum (when it exists). The deviance is D = −2ℓ(β̂), used for nested model comparisons.
SCORE EQUATIONS & IRLS
∂ℓ/∂β = Xᵀ(y − π) = 0 → β⁽ᵗ⁺¹⁾ = (XᵀWX)⁻¹XᵀWz
The score vector Xᵀ(y − π) sets to zero at the MLE. The IRLS update uses W = diag(πᵢ(1 − πᵢ)), the weight matrix, and z = Xβ⁽ᵗ⁾ + W⁻¹(y − π), the working response. Each iteration is a weighted least squares problem, connecting logistic regression to familiar linear algebra.
FISHER INFORMATION & STANDARD ERRORS
I(β) = XᵀWX → Var(β̂) ≈ (XᵀWX)⁻¹
The observed Fisher information matrix provides asymptotic covariance estimates for β̂. Wald tests use the ratio β̂ⱼ / SE(β̂ⱼ) ~ N(0,1) under H₀: βⱼ = 0. Alternatively, likelihood ratio tests compare nested models via ΔD ~ χ²(Δdf).
📐 Why the Canonical Link?
The logit is the canonical link for the Bernoulli distribution because it equates the linear predictor to the natural parameter θ = log(π/(1−π)) of the exponential family representation. Using the canonical link simplifies the score equations to Xᵀ(y − π) = 0, ensures concavity of the log-likelihood, and yields sufficient statistics Xᵀy. While alternative links (probit, complementary log-log) are valid, the logit retains these computational and theoretical advantages.

Model Assessment & Diagnostics

Assessing goodness of fit and identifying influential observations are critical steps in any logistic regression analysis. Unlike ordinary linear regression, where residual plots and R² are standard, binary response models require specialized diagnostics. The deviance, Pearson residuals, and information criteria serve as the primary tools. The diagram below presents a decision-oriented overview of the diagnostic workflow.

A diagnostic workflow for logistic regression: after fitting the model via IRLS, assess overall fit (deviance, AIC, Hosmer–Lemeshow test), examine residuals and influential observations, evaluate predictive performance (ROC/AUC, calibration), and then finalize the model for interpretation.
Key diagnostic measures for logistic regression models
Diagnostic ToolFormula / DefinitionInterpretation
Deviance residualdᵢ = sign(yᵢ − π̂ᵢ) √(−2[yᵢ log π̂ᵢ + (1−yᵢ) log(1−π̂ᵢ)])Contribution of observation i to the deviance. Should be approximately standard normal for a well-fitting model with grouped data.
Pearson residualrₚ = (yᵢ − π̂ᵢ) / √(π̂ᵢ(1 − π̂ᵢ))Standardized raw residual. The sum of squared Pearson residuals yields the Pearson χ² statistic.
Hosmer–Lemeshow testGroup observations into deciles of π̂; compare observed vs. expected counts via χ²Tests calibration. A significant p-value suggests lack of fit, though the test has low power with small samples.
AUC / ROCPlot sensitivity vs. (1 − specificity) over all thresholds; AUC = P(π̂₁ > π̂₀)Measures discrimination ability. AUC = 0.5 is no better than chance; AUC > 0.8 indicates good discrimination.

Worked Example: Predicting Graduate Admission

Consider a study of graduate school admission decisions. The binary response is Admit (Y = 1) or Deny (Y = 0), and the predictors are GRE score (continuous, centered at the sample mean of 600) and Research Experience (binary: 1 = yes, 0 = no). Using a sample of n = 200 applicants, suppose the fitted model yields β̂₀ = −1.20, β̂₁ = 0.008 (for centered GRE), and β̂₂ = 1.05 (for Research). Let us interpret these results and compute a predicted probability.

Computing and Interpreting Logistic Regression Output
1
Step 1 — Write the Fitted ModelThe fitted logistic regression equation on the log-odds scale is: logit(π̂) = −1.20 + 0.008 × GRE_centered + 1.05 × Research. Here the intercept −1.20 represents the log-odds of admission for an applicant with a GRE score equal to the sample mean (600) and no research experience.
logit(π̂) = −1.20 + 0.008 × GRE_c + 1.05 × Research
2
Step 2 — Interpret Coefficients as Odds RatiosExponentiating each coefficient gives the odds ratio (OR). For GRE: exp(0.008) ≈ 1.008, meaning each additional GRE point multiplies the odds of admission by 1.008; equivalently, a 50-point increase multiplies the odds by exp(50 × 0.008) = exp(0.40) ≈ 1.49. For Research: exp(1.05) ≈ 2.86, meaning having research experience nearly triples the odds of admission compared to having none, holding GRE constant.
OR_GRE(50pt) ≈ 1.49; OR_Research ≈ 2.86
3
Step 3 — Predict π̂ for a Specific ApplicantSuppose an applicant has GRE = 650 (so GRE_centered = 50) and Research = 1. The linear predictor is η̂ = −1.20 + 0.008(50) + 1.05(1) = −1.20 + 0.40 + 1.05 = 0.25. Applying the inverse logit: π̂ = exp(0.25) / (1 + exp(0.25)) = 1.284 / 2.284 ≈ 0.562.
π̂ ≈ 0.562 — this applicant has about a 56.2% predicted probability of admission.
4
Step 4 — Construct a Wald Confidence IntervalSuppose SE(β̂₂) = 0.42 for the Research coefficient. A 95% Wald CI on the log-odds scale is β̂₂ ± 1.96 × SE = 1.05 ± 1.96(0.42) = (0.227, 1.873). Exponentiating gives a 95% CI for the odds ratio: (exp(0.227), exp(1.873)) = (1.255, 6.508). Since this interval does not contain 1, research experience is statistically significantly associated with admission at the 5% level.
95% CI for OR_Research: (1.255, 6.508) — significant at α = 0.05
5
Step 5 — Evaluate Model FitThe residual deviance is 240.3 on 197 degrees of freedom (null deviance: 270.0 on 199 df). The difference ΔD = 270.0 − 240.3 = 29.7 on 2 df is compared to χ²₂, yielding p < 0.001. The model with both predictors fits significantly better than the null model. The AIC is 240.3 + 2(3) = 246.3, which can be compared to competing models.
ΔD = 29.7, df = 2, p < 0.001; AIC = 246.3

Strengths, Limitations, & Practical Considerations

Comparative strengths and limitations of logistic regression
StrengthsLimitations
Coefficients have a direct probabilistic interpretation as log-odds ratios, facilitating communication with domain experts.Assumes a linear relationship on the logit scale; misspecification can lead to biased estimates and poor calibration.
The concave log-likelihood guarantees a unique global maximum, making optimization reliable and well-behaved.Complete or quasi-complete separation causes the MLE to diverge; requires penalized methods (Firth regression) or Bayesian approaches.
Embedded within the GLM framework, enabling systematic comparison with probit, complementary log-log, and other models.Sensitive to multicollinearity among predictors, which inflates standard errors and destabilizes coefficient estimates.
Requires no distributional assumption on predictors (unlike LDA); works with continuous, discrete, and mixed covariate types.Standard diagnostics (R², residual plots) from linear regression do not directly apply; requires specialized goodness-of-fit tools.
Naturally extends to multinomial and ordinal responses via the multinomial logit and proportional odds models.Cannot capture complex nonlinear decision boundaries without explicit feature engineering or interaction terms.
KEY TAKEAWAY
Logistic regression occupies a "sweet spot" in the bias-variance tradeoff for binary classification: it imposes just enough structure (linearity on the logit scale) to yield interpretable, stable estimates, while remaining flexible enough to accommodate diverse predictor types. When the true decision boundary is approximately linear in log-odds, logistic regression often outperforms more complex methods because it is less prone to overfitting—analogous to how a well-calibrated instrument outperforms a high-sensitivity detector that amplifies noise along with signal.

Connection to Advanced Theory & Extensions

Logistic regression serves as a gateway to a rich landscape of advanced methods. Its position within the GLM framework makes it a natural starting point for understanding models with non-Gaussian responses, while its likelihood-based estimation connects directly to modern regularization and Bayesian techniques. The table below situates logistic regression relative to several important extensions.

Extensions of logistic regression and their relationships to the base model
ExtensionRelationship to Logistic RegressionKey Application
Multinomial LogitExtends binary logistic regression to J > 2 unordered categories by modeling J−1 log-odds relative to a reference category.Discrete choice models in economics; multi-class classification in machine learning.
Ordinal (Proportional Odds)Uses cumulative logits: logit(P(Y ≤ j)) = αⱼ − xᵀβ. Assumes the effect of predictors is constant across cut-points (proportional odds assumption).Likert-scale survey responses; disease severity staging.
Mixed-Effects LogisticAdds random intercepts/slopes to account for clustering (e.g., patients within hospitals). Estimation via adaptive Gauss–Hermite quadrature or Laplace approximation.Longitudinal binary data; multi-level epidemiological studies.
Regularized Logistic (LASSO/Ridge)Adds an ℓ₁ or ℓ₂ penalty to the log-likelihood, yielding penalized MLEs. Handles p >> n settings and performs variable selection (LASSO) or coefficient shrinkage (Ridge).Genomics, text classification, high-dimensional biomarker selection.
Bayesian Logistic RegressionReplaces MLE with posterior inference using priors on β. Naturally handles separation via informative priors and produces full posterior distributions for uncertainty quantification.Small-sample clinical trials; rare-event modeling; hierarchical meta-analysis.

A particularly important theoretical connection is the relationship between logistic regression and neural networks: a single-layer neural network with a sigmoid activation function and binary cross-entropy loss is algebraically identical to logistic regression. Deep neural networks can therefore be viewed as stacking multiple nonlinear logistic transformations, with logistic regression serving as the foundational building block. This perspective underscores why understanding logistic regression is essential not only for classical statistics but also for modern machine learning.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why ordinary least squares regression is inappropriate for modeling a binary response variable. In your answer, identify at least two specific statistical violations that arise and describe how the logistic regression model addresses each one.
PROBLEM 2BASIC CALCULATION
A logistic regression model yields logit(π̂) = −3.5 + 0.02 × Income (in thousands of dollars). (a) Compute the predicted probability of the event for a person with Income = $80,000. (b) Compute the odds ratio for a $10,000 increase in income.
PROBLEM 3INTERMEDIATE
A researcher fits two nested logistic regression models to n = 500 observations. Model A (intercept + Age) has a residual deviance of 620.4 on 498 df. Model B (intercept + Age + Smoking + Age×Smoking) has a residual deviance of 598.1 on 496 df. Perform a likelihood ratio test at the α = 0.05 level to determine whether the additional terms in Model B significantly improve fit. State the null and alternative hypotheses and the test conclusion.
PROBLEM 4APPLIED
An epidemiologist studying coronary heart disease (CHD) fits a logistic regression model with predictors: LDL cholesterol (mg/dL), Systolic BP (mmHg), and Diabetes (0/1). The fitted coefficients are β̂_LDL = 0.015 (SE = 0.004), β̂_SBP = 0.022 (SE = 0.008), β̂_Diabetes = 0.85 (SE = 0.30), β̂₀ = −8.10. (a) Compute 95% Wald confidence intervals for the odds ratios of LDL (per 10 mg/dL increase), SBP (per 10 mmHg increase), and Diabetes. (b) Which predictor has the strongest association with CHD risk, and how do you justify this claim?
PROBLEM 5CRITICAL THINKING
A data analyst discovers that a logistic regression model for credit default exhibits complete separation: all applicants with a credit score above 780 were non-defaulters, and the MLE for the credit score coefficient diverges to +∞. (a) Explain mathematically why complete separation causes the MLE to be undefined. (b) Propose two principled solutions, explaining the theoretical rationale for each. (c) Discuss how you would detect separation in practice before observing divergent coefficient estimates.

Logistic Regression — Summary

Logistic regression is a generalized linear model for binary outcomes that uses the logit link function to connect the linear predictor to the probability of the event via the sigmoid (inverse logit) function. The response follows a Bernoulli distribution, and parameters are estimated by maximum likelihood estimation using iterative algorithms such as IRLS (iteratively reweighted least squares). Exponentiated coefficients yield odds ratios, providing an interpretable measure of effect size for each predictor.

Model assessment relies on deviance and likelihood ratio tests for nested model comparisons, ROC curves and AUC for discrimination, and Hosmer–Lemeshow tests for calibration. Key challenges include complete separation and multicollinearity, which are addressed through penalized and Bayesian extensions. Logistic regression extends naturally to multinomial and ordinal responses, mixed-effects models for clustered data, and regularized estimation (LASSO/Ridge) for high-dimensional settings, making it one of the most versatile tools in the statistician's repertoire.

Varsity Tutors • Statistics Graduate Level • Logistic Regression