By the end of this lesson, you should be able to
- Explain why a linear probability model can be problematic.
- Convert between log-odds, odds, and probability.
- Interpret a logistic coefficient as a conditional odds ratio.
Suppose an outcome can only be yes or no. A straight-line regression might predict a probability of 1.4, or −.2. Neither is a probability.
Logistic regression avoids this particular embarrassment by modeling the log odds rather than probability directly.
The link from a line to a probability
Let be the modeled probability of an event given predictors. Logistic regression uses
The inverse of the logit is the logistic function:
Whatever real number appears on the right-hand side of the linear predictor, the resulting probability lies between zero and one.
Odds are not probability
Odds of 1:4 correspond to a probability of .
A logistic coefficient describes a one-unit change in log odds holding the other included predictors fixed. Exponentiating gives an odds ratio: .
Suppose and . At , the log odds are , so
Increasing x by one multiplies fitted odds by in this model. It does not multiply probability by 1.649; odds ratios and risk ratios are not the same.
A genuine R fit
Using a synthetic dataset of binary outcomes:
x <- c(0,0,1,1,2,2,3,3,4,4)
y <- c(0,0,0,1,0,1,1,0,1,1)
fit <- glm(y ~ x, family=binomial())
summary(fit)
predict(fit, newdata=data.frame(x=2), type="response")
Real models may require diagnostics, more predictors, assessment of dependence, and consideration of rare outcomes or separation.
Interpretation is conditional, not automatically causal
A predictor can be associated with the chance of an event without causing it. Study design and confounding remain central.
When communicating results, consider fitted probabilities or risk differences alongside odds ratios, and specify the population and predictors held fixed.
Check your understanding
- Convert odds of 1:3 into probability.
- What does represent in a logistic regression?
- Does an odds ratio of 2 necessarily mean the event is twice as probable?
Worked responses
-
.
-
The model’s multiplicative change in odds per one-unit predictor increase, holding other terms fixed.
-
No. Odds and probability are different scales.
Fitting requires a likelihood, not squared residuals
For independent binary responses and modeled probabilities , the Bernoulli likelihood is . Its log is
Logistic regression usually estimates coefficients by maximizing this expression numerically. The outcome model and optimization criterion differ from ordinary least squares. Replacing binary outcomes by logits is not a valid shortcut, because observed zeros and ones have infinite logits.
For the hypothetical coefficients and , the probabilities at and are approximately and . Their difference is about while their odds ratio is . At and , the same odds ratio corresponds to probabilities about and , a smaller difference of . A constant log-odds slope does not imply a constant probability difference. Differentiating the logistic function gives , which makes the baseline dependence explicit.
If a coefficient estimate is with estimated standard error , a large-sample Wald interval for its conditional odds ratio is . For , , and , it is approximately . This is an asymptotic interval, not an exact small-sample guarantee. Profile-likelihood methods can behave differently.
Complete separation occurs when a predictor boundary perfectly distinguishes all observed outcomes. Coefficients can diverge while the likelihood approaches a limiting supremum. A convergence warning or huge standard error should prompt inspection of the data and model, not automatic deletion of an inconvenient observation. Also inspect calibration, influential observations, and whether the logit relationship is plausibly linear in continuous predictors.
Additional practice
- Convert probability to odds and log odds.
- If baseline probability is and odds double, find the new probability.
- Why does a conditional odds ratio not automatically describe a causal intervention?
Worked additional solutions
- Odds and log odds .
- Baseline odds are ; doubled odds are , giving probability .
- The coefficient conditions on included predictors under a model. Unmeasured confounding, selection, and the distinction between observing and intervening remain.
Keep your place
Mark this lesson complete after you've read it, attempted its exercises, and explained its central idea in your own words.
Progress is not saved unless you choose to mark the lesson complete.
Saved only in this browser's local storage. No required account, server transmission, or analytics. You can reset your saved progress on the course page. Clearing browser data also clears the record.