What you see
Every person either relapsed (Y=1, top) or did not (Y=0, bottom) — the points are only "jittered" vertically for readability, but in reality there are only these two values. Both curves are fit to the same simulated data: the orange line is an ordinary OLS model (Linear Probability Model, LPM) — lm(Relapse ~ Age). The blue S-curve is the logistic regression — glm(Relapse ~ Age, family = binomial).
The LPM's problem
A straight line knows no bounds. Drag the slider to a high or low age — the red/orange hatched zone marks where the LPM predicts a probability outside [0,1]. A "P(Relapse) = 1.14" or "= −0.08" is not a valid value for a probability — the model is simply misspecified at that point.
The solution: the S-curve
The logistic function is constructed so that it by definition can never fall below 0 or rise above 1 — it only approaches these bounds asymptotically, never reaching them. That makes every prediction an automatically plausible probability, no matter how extreme the X value.
What to do
Click ↻ New Data for a fresh random sample — the basic finding stays stable: the LPM violates its own range as soon as you move away from the center of the data. Logistic regression never does. Onward to Module ②: how does the S-shape actually come about?
logit(Relapse) = −0.672 + 0.518 · male
(female = 0 coded, reference)
What you see
The same two points A and B = A+Δ, plotted simultaneously on three scales of the same model logit(P) = −2.5 + 0.06·cigarettes. The Point A slider shifts both points together along the X axis, Step size Δ changes the distance between them.
Slide Point A back and forth while Δ stays fixed
Panel ① (Logit) and the "ΔLogit" number never change — the line has the same slope b₁ everywhere. Panel ② (Odds) and "OR" also never change — the same step Δ in the predictor always means the same factor on the odds scale. But Panel ③ (Probability) and "ΔP" change substantially, depending on where A currently sits.
Why?
Logit differences are additive (b₁·Δ is a constant), odds ratios are multiplicative (e^(b₁·Δ) is a constant) — but probability is a curved function of the logit. The same additive/multiplicative step sometimes lands on the steep middle of the S-curve (large ΔP), sometimes on a flat edge (small ΔP).
Why isn't one number enough?
A single OR or logit coefficient describes the relationship completely on the logit scale — but nobody thinks in logits. Once you convert back to the probability scale (which people have intuition for), the effect is no longer constant. Only a curve — not a single coefficient — shows where the predictor matters a lot and where it barely matters. That's why Module ④ always plots instead of just tabulating.
dP/dX = b₁ · P·(1−P). This curve is a downward-opening parabola in P: maximal at P=0.5 (value 0.25), zero at P=0 or P=1. It summarizes what the three panels above already show: the same logit coefficient b₁ has the largest effect on the probability in the middle of the S-curve and almost none at its edges.
Software (e.g. the R package marginaleffects, Stata's margins) usually reports either the Average Marginal Effect (the mean of dP/dX across all observed X) or the Marginal Effect at the Mean (dP/dX evaluated at X̄) as a compromise number for this curve.
"Sex × Status" view
Two categorical predictors + interaction are barely intuitive to read as a coefficient table: six numbers (intercept, 2 main effects, plus interaction) on the logit scale. Converted back to probabilities, they become six bars with a 95% confidence interval — at a glance you can see which group carries the highest relapse risk and where the confidence intervals overlap (no reliable difference).
"Status × Cigarettes" view
One categorical and one continuous predictor together: three S-curves (one per status level) over cigarette consumption, with a confidence band. This shows simultaneously the effect of the continuous predictor (curve shape, Module ③) and the offset from the categorical variable (distance between curves) — something a coefficient table alone could never show together.
Sliders: change the effects yourself
On the left you can freely set b₀, the main effects, and an interaction on the logit scale. Raise "Interaction m×low", for instance: the sex difference becomes larger or smaller within the "low" status group than in the other groups — the bars visibly diverge instead of staying parallel. In the second view, "Interaction cig.×low" rotates one S-curve's slope relative to the other two. ↺ Lecture values resets the original values from the lecture.
Where do the confidence intervals come from?
Not made up: for whatever effects are currently set, a synthetic but realistic dataset is simulated and refit live via Newton-Raphson (IRLS) — the same algorithm R's glm() uses. The CIs are genuine Wald confidence intervals from that fit's covariance matrix, not an illustration. The info box on the left shows both: the effects you set, and what a fit on the simulated data (with real sampling noise) recovers from them.
Relation to the GLM framework
Logistic regression is a special case of the Generalized Linear Model: the same predictor structure (main effects, interactions, dummy coding) as in OLS & Multiple Regression or ANOVA — just with a logit link instead of an identity link, and a binomial instead of a normal distribution. For classification quality (cutoff, sensitivity/specificity, ROC/AUC), see the dedicated Sensitivity & Specificity tool. For logistic regression as a tool for confounding control, see Propensity Score Matching.
Odds = P/(1−P) relaxes the upper bound, Logit = ln(Odds)
removes the lower bound too — only the logit is unbounded (−∞, +∞) and thus
suitable as a linear target: logit(P) = b₀ + b₁·X.
OR = eb₁ — differences of log-odds exponentiate to
ratios, not differences. OR = 1.68 means 68% higher odds,
not 68 percentage points higher probability. This mix-up is the
most common interpretation error in logistic regression.
dP/dX = b₁ · P·(1−P) — the same logit coefficient b₁ produces a
differently sized effect on the probability depending on the current P: maximal
at P = 0.5, minimal at the extremes (P near 0 or 1).
When the dependent variable Y is binary (0/1, e.g. relapse yes/no), ordinary OLS regression (a Linear Probability Model) systematically violates its own range: it predicts probabilities below 0 or above 1. Logistic regression instead models the logit of P(Y=1) linearly:
logit(P) = ln( P / (1−P) ) = b₀ + b₁·X₁ + … + bₖ·Xₖ
Back-transformed, this yields an S-shaped function that gives a valid probability for every X value:
P(Y=1) = 1 / (1 + e−(b₀+b₁·X))
glm().
b₁ (logit scale): "For each +1 unit of X, the logit of P(Y=1) increases by b₁" — correct, but practically unintuitive, since nobody thinks in logits.
OR = eb₁ (odds ratio): "For each +1 unit of X, the odds of Y=1 are multiplied by the factor OR." Multiplicative, not additive — an OR of 2 means "twice the odds," not "50 percentage points more."
Predicted probability: the only quantity people can intuitively picture. But it is nonlinear in X — hence Module ③ of this tool.
The derivative of P with respect to X is dP/dX = b₁ · P·(1−P). The
term P·(1−P) is a downward-opening parabola with a maximum at P=0.5 (value 0.25)
and zeros at P=0 and P=1. The same logit coefficient thus has almost no effect on
the probability near the extremes, but the largest effect in the middle. Software
usually reports the Average Marginal Effect (AME) as a compromise number.
Hosmer, D. W., Lemeshow, S. & Sturdivant, R. X. (2013). Applied Logistic Regression (3rd ed.). Wiley.