Build a logistic regression model and explain what its output means
The idea
When the dependent variable is binary, linear regression can predict probabilities below 0 or above 1. Logistic regression instead models the log odds: ln[p ÷ (1 − p)] = b0 + b1X1 + … + bkXk, estimated by maximum likelihood. To get a probability, compute the log odds and then p = 1 ÷ (1 + e raised to minus the log odds). A slope is the change in log odds for a one-unit change in the variable, so e raised to the slope is the factor by which the odds are multiplied. Joint significance uses the likelihood ratio test, −2 × (restricted log-likelihood − unrestricted log-likelihood), against a chi-square. A common slip is to confuse odds with probability.
Formulas
Log odds in a logistic regression
ln[p ÷ (1 − p)] = b₀ + b₁ × X₁
- p
- the probability of the event
- b₀
- the fitted intercept
- b₁
- the fitted coefficient (a model may have more)
- X₁
- an explanatory variable
Convert log odds to a probability with p = 1 ÷ (1 + e raised to minus the log odds). A coefficient multiplies the odds by e raised to that coefficient.
Likelihood ratio test
LR = −2 × (LL restricted − LL unrestricted)
- LL restricted
- the log likelihood of the model with the restrictions
- LL unrestricted
- the log likelihood of the full model
- LR
- the statistic, compared with chi-square with one degree of freedom per restriction
The logistic regression counterpart of the joint F-test.
In the app: 8 practice questions on this outcome, a narrated walkthrough with diagrams, spaced review that brings it back before you forget it.
Take the free diagnostic →