How to Interpret Logistic Regression and Odds Ratios

An orange S-shaped logistic curve, with the horizontal axis running from −6 to 6 and the vertical axis from 0 to 1, passing through 0.5 at horizontal coordinate 0.

The curve of the standard logistic function π = eˣ/(1+eˣ): the independent variable can take any real value, while the function always takes values between 0 and 1. Author: Qef; source: Wikimedia Commons; license: public domain.

Logistic regression is a common model for analyzing binary outcomes: it expresses the log odds of an event as a linear combination of predictors, and exponentiating a coefficient gives an odds ratio. An odds ratio is not the same as a risk ratio; the more common the outcome and the larger the effect, the further the two diverge. Drawing on generalized linear model textbooks and methodological literature, this entry explains model specification, coefficient interpretation, diagnostics and overfitting risks, situations where the model is inappropriate, and a worked example that can be checked by hand.

Specifying a Model for Binary Outcomes

When an outcome has only two possible values, “event/no event,” directly fitting a 0/1 variable with ordinary linear regression can produce predictions below 0 or above 1. A generalized linear model (GLM) has three components: the random component specifies that the outcome Y follows a binomial distribution for a single trial, with event probability π; the systematic component is a linear combination of predictors; and the link function connects π to that linear combination. Logistic regression uses the logit link:

logit(π) = log[π / (1 − π)] = β₀ + β₁x₁ + … + βₖxₖ

Solving for π gives π = exp(η) / [1 + exp(η)], where η = β₀ + β₁x₁ + … + βₖxₖ.

Here, π/(1−π) is called the odds: the ratio of the probability of an event to the probability of no event. The log odds can take any real value, but the resulting π always lies between 0 and 1 and follows an S-shaped curve as η changes. The model has no separate normally distributed error term and does not require the outcome to follow a normal distribution. It does, however, require independent observations and assumes a linear relationship between the log odds and the predictors. Parameters are usually estimated by maximum likelihood; nested models can be compared using the difference in deviance, which gives a likelihood ratio test.

Odds Ratios and Risk Ratios

Let the event risks in the exposed and unexposed groups be P₁ and P₀, respectively. The risk ratio (relative risk, RR) is P₁/P₀; the odds ratio (OR) is [P₁/(1−P₁)] ÷ [P₀/(1−P₀)]. Their relationship is OR = RR × (1−P₀)/(1−P₁), which can be rearranged as RR = OR ÷ (1 − P₀ + P₀×OR).

Davies and colleagues quantified the difference in BMJ in 1998: interpreting an odds ratio as a risk ratio always exaggerates the effect, with OR greater than RR when OR greater than 1 and OR less than RR when OR less than 1; the exaggeration increases with both baseline risk and effect size; as long as baseline risk multiplied by OR is less than 100%, OR overestimates RR by no more than a factor of two. They also noted that large discrepancies arise only when both baseline risk and the effect are large. In such cases, either measure leads to the conclusion that “the effect is large,” so the qualitative judgment usually remains unchanged. For quantitative analyses such as cost-effectiveness analysis, however, the risk ratio itself should still be calculated.

A graph with risk ratio on the horizontal axis and odds ratio on the vertical axis, showing five curves corresponding to baseline risks from 1% to 50%; the higher the baseline risk, the more steeply the curve departs from the blue dashed line y = x

The relationship between risk ratio (horizontal axis) and odds ratio (vertical axis): the five curves correspond to baseline risks of 1%, 5%, 10%, 25%, and 50%, respectively, and the blue dashed line represents OR = RR. The higher the baseline risk, the larger the odds ratio corresponding to the same risk ratio, consistent with the conversion relationship described by Davies and colleagues (1998). Author: D Wells; source: Wikimedia Commons; license: CC BY-SA 4.0.

The difference can be substantial in real data. In Zou’s 2004 analysis of microalbuminuria data from 172 patients with diabetes in the DCCT trial, modified Poisson regression estimated a risk ratio of 2.95; treating the odds ratio of 4.87 from logistic regression as a risk ratio would overestimate it by 65%. Odds ratios also have uses that risk ratios cannot replace: case-control studies cannot directly estimate risk ratios, whereas the odds ratio is the same quantity in cohort and case-control studies. This is another reason logistic regression is often chosen in epidemiology.

Interpreting Coefficients and a Reproducible Worked Example

βⱼ represents the change in log odds for each 1-unit increase in xⱼ, holding the other predictors constant; exp(βⱼ) is the multiplier of the odds, or the adjusted odds ratio for that variable. The exponentiated intercept, exp(β₀), is the odds when all predictors equal 0. With many variables, this “baseline” may not correspond to any actual population. βⱼ greater than zero means that both the odds and the probability of the event increase as xⱼ increases; βⱼ less than zero means the reverse. The units of a continuous variable change the numerical value of its odds ratio: when age is measured in units of 10 years, the odds ratio is the 10th power of the odds ratio obtained when age is measured in units of 1 year.

The odds ratio is a constant multiplier across the entire curve, but the change in probability depends on the baseline. Differentiating π gives dπ/dx = β·π(1−π), which reaches its maximum at π = 0.5, where it equals β/4. For example, if a continuous variable has β = 0.2, each 1-unit increase multiplies the odds by e^0.2 ≈ 1.22; when the baseline probability is near 50%, the probability increases by approximately 5 percentage points, whereas at a baseline probability of 10%, it increases by only about 1.8 percentage points. Results should therefore ideally report both odds ratios and predicted probabilities or probability differences at representative values.

Reproducible worked example: Suppose a cohort study has 40 outcomes among 100 exposed people and 20 outcomes among 100 unexposed people.

Group Event No event Risk Odds
Exposed 40 60 0.40 40/60 ≈ 0.667
Unexposed 20 80 0.20 20/80 = 0.25
  1. The risk ratio is RR = 0.40 ÷ 0.20 = 2.00; the odds ratio is OR = 0.667 ÷ 0.25 = (40×80)/(60×20) ≈ 2.67.
  2. Fitting logistic regression with exposure (yes = 1, no = 0) as the sole predictor gives maximum likelihood estimates consistent with the contingency table: β₀ = ln 0.25 ≈ −1.386, β₁ = ln(8/3) ≈ 0.981. Substituting these into the model gives π = 0.25/1.25 = 0.20 for the unexposed group and η = −0.405, π = 0.667/1.667 = 0.40 for the exposed group, exactly recovering the observed risks in both groups.
  3. The standard error of the log odds ratio is SE = √(1/40 + 1/60 + 1/20 + 1/80) = √0.1042 ≈ 0.323, and the Wald statistic is z = 0.981 ÷ 0.323 ≈ 3.04. The 95% confidence interval is first calculated on the log scale: 0.981 ± 1.96 × 0.323, giving (0.348, 1.613); after exponentiation, the 95% confidence interval for OR is 1.42 to 5.02.
  4. Checking with the conversion formula: RR = 2.67 ÷ (1 − 0.20 + 0.20 × 2.67) = 2.67 ÷ 1.333 = 2.00. Baseline risk multiplied by OR is approximately 0.53, which is less than 1; OR exceeds RR by approximately 33%, within the range of “overestimation by no more than a factor of two.”
  5. If the risks in the two groups are changed to 4% and 2% (a rare outcome), RR remains 2.00 and OR = (4/96) ÷ (2/98) ≈ 2.04, so the two nearly coincide.

Diagnostics, Overfitting, and Limits of Applicability

For overall fit, when a model contains continuous predictors, each covariate combination often has only one observation. Pearson X² and deviance G² then no longer approximately follow chi-square distributions and should not be used directly to test goodness of fit. There are two common alternatives: compare the difference in deviance against a larger model containing additional variables, quadratic terms, or interactions; or use the Hosmer–Lemeshow test, which divides observations into g groups according to predicted probabilities and compares the observed and expected numbers of events within each group, approximately following a chi-square distribution with g−2 degrees of freedom. Penn State’s STAT 504 notes caution that this test tends to be conservative, has low power to detect lack of fit such as nonlinearity, and depends on how observations are grouped. With too few groups, such as no more than 5, it almost always fails to reject the null hypothesis, so a “nonsignificant” result cannot be taken as evidence that the model is correct. Diagnostics for individual observations can examine Pearson residuals, deviance residuals, and influence statistics such as DFBETA.

Overfitting means that a model makes overly extreme predictions on its development data: predicted probabilities are too close to 1 for high-risk individuals and too close to 0 for low-risk individuals, leading to poor calibration in a new sample from the same population. A popular rule of thumb requires at least 10 events per candidate parameter (10 EPV, with the event count taken from the less frequent of the two outcome categories), with the simulation study by Peduzzi and colleagues in 1996 providing one of its main foundations. After comparing multiple simulation studies, van Smeden and colleagues concluded in 2016 that the evidence for this rule was very weak: small-sample problems also depend on factors such as total sample size, and maximum likelihood coefficients in small samples are systematically biased away from 0, overstating the strength of associations. In BMJ in 2020, Riley and colleagues proposed calculating the development sample size using the number of candidate parameters, outcome proportion, and anticipated Cox–Snell R². One objective is a required shrinkage factor of 0.9, meaning shrinkage of no more than 10%, and they provided the pmsampsize package for R and Stata. In their example, a logistic model with 20 candidate parameters and an anticipated R² of at least 0.1 requires 1698 people; with an outcome proportion of 0.3, this corresponds to approximately 25.5 events per parameter, far above 10.

Small samples with many variables are also prone to “separation”: a variable or combination of variables completely separates events from nonevents, so the maximum likelihood estimate has no finite solution. Software may fail to converge or report extremely large coefficients and standard errors, and results can differ considerably across software packages. Simulations by van Smeden and colleagues showed that Firth correction, which adds a penalty term to the likelihood function, still produces finite coefficients with separated data and can improve the accuracy of coefficients in small samples.

Ordinary logistic regression should not be forced onto the following situations:

  • The study needs to report risk ratios, and the outcome is not rare: Cohort studies and trials can directly estimate risk ratios using binomial regression with a log link. This approach is sensitive to starting values and may fail to converge; an alternative is Zou’s modified Poisson regression (Poisson regression with a robust “sandwich” variance). Zou also noted that directly applying the conversion formula to adjusted odds ratios does not necessarily produce consistent risk ratio estimates.
  • Observations are not independent: Repeated measurements on the same subject, cluster sampling, or cluster randomization violate the independence assumption and require marginal models or random-effects (multilevel) models.
  • The outcome has more than two categories: Ordered or unordered multicategory outcomes can be analyzed using ordinal or multinomial logistic models, rather than first artificially combining them into two categories.
  • The question concerns “when” an event occurs, and there is censoring: When follow-up times differ or some participants are lost to follow-up, looking only at whether an event occurred discards timing information. These questions belong to survival analysis.
  • There is separation or very few events: Use penalized estimation such as Firth correction and reduce the number of candidate variables.

References

  1. Agresti A. Categorical Data Analysis. 3rd ed. Wiley; 2013. Publisher’s page

  2. Penn State Eberly College of Science. STAT 504: Analysis of Discrete Data. Lesson 6: Binary Logistic Regression; Lesson 7: Further Topics on Logistic Regression

  3. Davies HTO, Crombie IK, Tavakoli M. When can odds ratios mislead? BMJ. 1998;316(7136):989–991. doi:10.1136/bmj.316.7136.989

  4. Zou G. A modified Poisson regression approach to prospective studies with binary data. American Journal of Epidemiology. 2004;159(7):702–706. doi:10.1093/aje/kwh090

  5. Peduzzi P, Concato J, Kemper E, Holford TR, Feinstein AR. A simulation study of the number of events per variable in logistic regression analysis. Journal of Clinical Epidemiology. 1996;49(12):1373–1379. doi:10.1016/S0895-4356(96)00236-3

  6. van Smeden M, de Groot JAH, Moons KGM, et al. No rationale for 1 variable per 10 events criterion for binary logistic regression analysis. BMC Medical Research Methodology. 2016;16:163. doi:10.1186/s12874-016-0267-3

  7. Riley RD, Ensor J, Snell KIE, et al. Calculating the sample size required for developing a clinical prediction model. BMJ. 2020;368:m441. doi:10.1136/bmj.m441

  8. Research Methods · Rituals can be imitated; understanding cannot be faked

  9. This information was compiled and published by Scholay One-Stop Academic Platform. Please report any infringement so the content can be removed.

  10. This information was also published on EnterScholar, a community for scholars in the age of intelligence.

Originally published at Metho.