Statistics & Analysis

Logistic Regression

Reviewed byShrishti Chaudhary

Definition

Logistic regression is a statistical method used to model the relationship between a binary dependent variable (one with two possible outcomes, such as disease present or absent) and one or more independent variables. It estimates the probability of the outcome occurring and expresses the effect of each predictor in terms of an odds ratio.[1][2]

Explore the concept

One odds ratio, many risk ratios

Slide the baseline risk along two logistic curves and watch the odds ratio hold at 2.4 while the risk ratio shrinks as the outcome gets common.

Surgical infection model, diabetes odds ratio 2.4

0%50%100%Other risk factors →Risk of infection
With diabetesWithout diabetes

Risk without diabetes

1%

Risk with diabetes

2.4%

Odds ratio

2.4

same at every level

Risk ratio

2.4

2.4% ÷ 1%

Odds ratio 2.4, risk ratio about 2.4

With a rare outcome the odds and the risk are almost the same number, so the risk ratio is about 2.4 too.

The big idea: Logistic regression models the log odds of a binary outcome as a straight line in the predictors, so each exponentiated coefficient is an odds ratio that stays the same across risk levels. The matching risk ratio is close to it only when the outcome is rare.

From the article: 3,000 surgical patients, 240 infections (8%), five predictors, diabetes odds ratio 2.4 (95% CI 1.7 to 3.4), AUC 0.76, and risk ratios of about 2.4, 2.1 and 1.5 at comparison group risks of 1%, 10% and 40%. Risks with diabetes and risk ratios are computed from OR 2.4 with RR = OR ÷ (1 − p₀ + p₀ × OR), an approximation for adjusted odds ratios. Events per predictor assumes one parameter per predictor. The S curves' horizontal axis and the ROC curve's shape (a binormal curve with area 0.76) are illustrative.

Why it matters

Many research outcomes are binary: a patient recovers or does not, a student passes or fails, a participant develops a disease or remains healthy. Linear regression is inappropriate for binary outcomes because it can predict probabilities outside the 0 to 1 range and violates the assumption of normally distributed residuals. Logistic regression resolves these problems by using the logit function to transform the probability of the outcome into a continuous, unbounded scale.[2] It is a standard method for analyzing binary outcomes in clinical research, epidemiology, public health, social science, and machine learning, and it forms the basis for more advanced methods such as multinomial logistic regression (for outcomes with more than two categories) and ordinal logistic regression (for ordered categories).

How it works

Logistic regression models the log odds of the outcome as a linear function of the predictors: log(p / (1 minus p)) = b₀ + b₁X₁ + b₂X₂ + ... + bₖXₖ, where p is the probability of the outcome, (1 minus p) is the probability of the outcome not occurring, and the ratio p/(1 minus p) is the odds.[1][2] The log odds (logit) is a continuous variable that ranges from negative infinity to positive infinity, making it suitable for linear modeling.

Each regression coefficient (b) represents the change in the log odds of the outcome associated with a one unit increase in the corresponding predictor, holding other predictors constant. Exponentiating the coefficient gives the odds ratio (OR), which is more interpretable: an OR greater than 1 indicates that the predictor is associated with higher odds of the outcome, an OR less than 1 indicates that it is associated with lower odds, and an OR of 1 indicates no association.[1][2]

Model estimation typically uses maximum likelihood estimation (MLE), which finds the parameter values that make the observed data most probable.[2] Calibration (how closely predicted probabilities match observed proportions) can be assessed with the Hosmer Lemeshow test or a calibration plot, discrimination (how well the model separates people with and without the outcome) with the area under the receiver operating characteristic (ROC) curve (AUC, or c statistic), and overall fit with measures such as the Nagelkerke pseudo R².[1][2] Variable selection strategies include forward, backward, and stepwise methods, though theory guided selection of predictors is preferred.

Assumptions of logistic regression include linearity of the logit (the relationship between continuous predictors and the log odds is linear), absence of multicollinearity among predictors, independence of observations, and an adequate sample size. A common rule of thumb is at least 10 events per candidate predictor, but it is only a rule of thumb: Riley and colleagues (2020) show that the sample size needed to develop a prediction model depends on the number of candidate predictor parameters, how common the outcome is and the expected model fit.[4][5]

When to use it

Use logistic regression whenever the dependent variable is binary and you want to estimate the probability of the outcome, identify significant predictors, or calculate odds ratios. It is appropriate for both experimental and observational data. For outcomes with more than two unordered categories, use multinomial logistic regression. For ordered outcomes, use ordinal logistic regression. For time to event outcomes where censoring is present, use survival analysis methods instead. When the outcome is rare (a common rule of thumb is below 10%) and the study design is cross sectional or cohort based, the odds ratio approximates the relative risk; as the outcome becomes more common, the odds ratio lies further from 1 than the risk ratio, and log binomial regression or Poisson regression with robust (sandwich) standard errors may be preferred for directly estimating relative risks.

Key takeaways

  • Many research outcomes are binary: a patient recovers or does not, a student passes or fails, a participant develops a disease or remains healthy.
  • Logistic regression models the log odds of the outcome as a linear function of the predictors: log(p / (1 minus p)) = b₀ + b₁X₁ + b₂X₂ + ... + bₖXₖ, where p is the probability of the outcome, (1 minus p) is the probability of the outcome not occurring, and the ratio p/(1 minus p) is the odds.
  • Use logistic regression whenever the dependent variable is binary and you want to estimate the probability of the outcome, identify significant predictors, or calculate odds ratios.
  • A common error is interpreting the odds ratio as a relative risk, which is appropriate only when the outcome is rare.

Common mistakes

  • A common error is interpreting the odds ratio as a relative risk, which is appropriate only when the outcome is rare.[3] For common outcomes, the odds ratio exaggerates the strength of the association relative to the risk ratio.[3] For example, an odds ratio of 2.4 corresponds to a risk ratio of about 2.4 when 1% of the comparison group has the outcome, about 2.1 when 10% do, and about 1.5 when 40% do (risk ratio = OR ÷ (1 − p₀ + p₀ × OR), where p₀ is the risk in the comparison group; for adjusted odds ratios this conversion is only approximate).[3][6]
  • Another mistake is including too many predictors relative to the number of events (not the total sample size), which leads to overfitting, unstable estimates, and biased odds ratios.[4]
  • Some researchers fail to check the linearity of the logit assumption for continuous predictors, which can be assessed using restricted cubic splines or by categorizing the predictor and examining the pattern.
  • Finally, using stepwise variable selection without theoretical justification produces models that are unstable and may not replicate in new samples.

Example

An epidemiologist investigates risk factors for hospital acquired infections in a cohort of 3,000 surgical patients, of whom 240 (8%) develop an infection. Logistic regression is used to model infection status (yes or no) as a function of age, BMI, diabetes status, surgical duration, and antibiotic prophylaxis. The model yields an odds ratio of 2.4 (95% CI: 1.7 to 3.4) for diabetes, indicating that patients with diabetes have 2.4 times the odds of infection compared to patients without diabetes, controlling for the other variables. The AUC is 0.76, indicating acceptable discrimination.

Test your understanding

5 questions that adapt as you go: answer two in a row correctly and they get harder.

Question 1 of 5

Scenario:

In the article's model, the coefficient for diabetes on the log odds scale is about 0.88.

Question:

What is the odds ratio for diabetes?

Hardness: Interpret

Sources

  1. [1]Field A. Discovering Statistics Using IBM SPSS Statistics. 6th ed. SAGE Publications, 2024. ISBN 9781529630008
  2. [2]Hosmer DW, Lemeshow S, Sturdivant RX. Applied Logistic Regression. 3rd ed. Wiley, 2013. doi:10.1002/9781118548387
  3. [3]Zhang J, Yu KF. What's the relative risk? A method of correcting the odds ratio in cohort studies of common outcomes. JAMA. 1998;280(19):1690-1691. doi:10.1001/jama.280.19.1690
  4. [4]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
  5. [5]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
  6. [6]McNutt LA, Wu C, Xue X, Hafner JP. Estimating the relative risk in cohort studies and clinical trials of common outcomes. Am J Epidemiol. 2003;157(10):940-943. doi:10.1093/aje/kwg074

Cite this term

FullPaperguide. (2026, October 15). Logistic Regression. In Paperguide Research Glossary. https://paperguide.ai/research-glossary/logistic-regression/
In-text(Paperguide, 2026)

Related terms