Learn / Biostatistics / Logistic and Poisson regression
Logistic regression: modelling a yes/no outcome
15 minute read · 6-question quiz
What you will learn
Explain why linear regression fails for binary outcomes and what the logit does
Interpret a logistic regression table: coefficients, odds ratios and confidence intervals
Convert a model to predicted probabilities
Most outcomes in health are binary: infected or not, dead or alive, readmitted or not. If we fit an ordinary straight line to a 0/1 outcome, predictions can fall below 0 or above 1, and the assumption of constant variance fails. Logistic regression solves this by modelling the log odds of the outcome, which can take any value from −∞ to +∞.
ln ((p)/(1 - p)) = β_0 + β_1 X_1 + β_2 X_2 + …
The left side is the logit of the probability p. Transforming back gives an S-shaped curve that stays between 0 and 1:
p = (1)/(1 + e^(-(β_0 + β_1 X_1 + …)))
From odds ratios to probabilities
Odds ratios are not probabilities. To report risks, plug a profile into the model. For a child without a net, aged over 2 and not poor (all other variables 0), the log odds is the intercept −1.27, so odds = 0.28 and
p = (0.28)/(1 + 0.28) = 0.22
For the same child with a net: log odds = −1.27 − 0.63 = −1.90, odds 0.15, p = 0.13. The absolute risk reduction is 9 percentage points. For a poor child under 2 without a net: log odds = −1.27 + 0.44 + 0.60 = −0.23, p = 0.44. Notice that the same odds ratio gives different absolute effects in different people, which is why reporting predicted probabilities for real profiles is so helpful.
Types of predictors
- Binary: OR compares the two groups.
- Continuous: OR is per one unit (or per 5 years, per 10 mmHg, whatever scale you choose). Check it is roughly linear on the log-odds scale; transform or use categories otherwise.
- Categorical: dummy variables against a reference level.
Fitting and testing
Logistic models are fitted by maximum likelihood, not least squares. Each coefficient has a Wald test (estimate ÷ SE) and a confidence interval. To compare nested models (with and without a set of variables), use the likelihood ratio test.
Sample size
A rough guide is at least 10 events per predictor variable (events means the less frequent outcome category). With 183 malaria cases and 3 predictors the model is well within limits; with only 20 events you could safely use 2 predictors.
Summary
Logistic regression models the log odds of a binary outcome; exp(β) is an odds ratio.
Confidence intervals are built on the log scale and then exponentiated.
Convert to predicted probabilities to express absolute risk for real profiles.
Aim for roughly 10 or more events per predictor.
For common outcomes, the OR overstates the RR; say 'odds'.
Check your understanding
Draft study guide. Spotted an error or something unclear? Tell us at hello@scintria.com. This is educational material, not clinical or regulatory advice.