Logistic Regression Explained
Table of Contents
Logistic regression helps answer questions with two possible outcomes: will a student pass an exam, or will a borrower default within the next year? It estimates a probability from the available inputs. A separate decision rule can then turn that probability into a label or action. Understanding those two steps helps you read a model without confusing a high predicted chance with a guaranteed result.
What Is Logistic Regression?
Binary logistic regression models an outcome coded as 1 for an event and 0 for its alternative. In an exam example, 1 can mean pass and 0 can mean fail. The inputs, called predictors, could include study hours, prior preparation or sleep. The output is the estimated probability of passing given those inputs.[1]
A predicted pass probability of 80% is a probability estimate. Calling that student a “predicted pass” requires a cutoff. Offering tutoring requires an action rule. These are related choices, but they answer different questions.
The event coding matters. If 1 instead means failing, a larger predicted probability means greater failure risk. Always check what the model calls the event before interpreting its results.
The Logistic Regression Formula
The model first combines its inputs into a linear score, usually written as z. With several inputs, that score has the same weighted-sum structure familiar from multiple regression analysis:
The score can be negative, zero or positive. It is not yet a probability. The logistic function converts it:
For any finite score, p falls strictly between 0 and 1. A score of zero gives 1 / (1 + 1) = 0.5. Negative scores produce probabilities below 50%; positive scores produce probabilities above 50%.[1] The probability curve becomes flatter toward either end, so large scores do not turn into impossible probabilities above 100%.
Example: Study Hours and Passing an Exam
Consider a hypothetical rule for one upcoming exam. Let h be study time in hours, with Y = 1 for passing. Choose the following score to illustrate the mechanics; these coefficients are not estimates from actual student data:
Vary study time from zero to six hours while keeping this rule fixed. The chart shows the resulting predicted pass probability, with a reference at three hours and 50%.
| Study time (hours) | Predicted pass probability (%) |
|---|---|
| 0 | 1.5 |
| 0.25 | 2.1 |
| 0.5 | 2.9 |
| 0.75 | 4.1 |
| 1 | 5.7 |
| 1.25 | 7.9 |
| 1.5 | 10.9 |
| 1.75 | 14.8 |
| 2 | 19.8 |
| 2.25 | 25.9 |
| 2.5 | 33.2 |
| 2.75 | 41.3 |
| 3 | 50.0 |
| 3.25 | 58.7 |
| 3.5 | 66.8 |
| 3.75 | 74.1 |
| 4 | 80.2 |
| 4.25 | 85.2 |
| 4.5 | 89.1 |
| 4.75 | 92.1 |
| 5 | 94.3 |
| 5.25 | 95.9 |
| 5.5 | 97.1 |
| 5.75 | 97.9 |
| 6 | 98.5 |
Hypothetical model evaluations at quarter-hour intervals; 50% probability at three hours. Values rounded to one decimal.
The curve rises most sharply around its midpoint and flattens toward the ends. The three-hour prediction is 50%; four hours produces about 80.2%. Here is that four-hour calculation:
Score: z = 1.4 × (4 − 3) = 1.4.
Probability: p = 1 / [1 + exp(−1.4)] = 1 / 1.246597 = 0.802184, or about 80.2%.
At five hours the same rule gives about 94.3%. Moving from three to four hours adds about 30.2 percentage points; moving from four to five adds about 14 percentage points, calculated before rounding. The added hour has a constant effect on the score, but a changing effect on probability.
Odds Ratios Are Different From Probability Changes
The score has a useful interpretation: it is the natural logarithm of the odds. Odds compare the chance of the event with the chance of its alternative:[2]
z = ln[p / (1 − p)]
Odds = exp(z)
For a rounded 80% probability, odds are 0.80 / 0.20 = 4 to 1: four chances of passing for each chance of failing. This does not mean a probability of four.
In the study-hours rule, each extra hour adds 1.4 to log odds. Exponentiating gives exp(1.4) = 4.0552: the odds of passing multiply by about four per hour. The exact four-hour model probability has odds of about 4.055 to 1; the simpler 4-to-1 statement uses the rounded 80% probability.
For a simple additive predictor, exp(βj) is its one-unit odds ratio, holding the other inputs fixed.[2] An odds multiplier above 1 raises the modeled probability; one below 1 lowers it. Neither tells you a fixed percentage-point change. To find that change, calculate the probability at both input values and subtract.
The supplementary video walks through this same study-hours idea with rounded probabilities and an odds multiplier of about four.
How Is Logistic Regression Fitted?
In actual analysis, software estimates the coefficients from observed inputs and outcomes. The usual unpenalized approach is maximum likelihood: choose coefficients that give the observed pattern of passes and failures the largest likelihood under the model.[3]
A student who passes contributes the predicted pass probability p. A student who fails contributes 1 − p. For example, suppose two hypothetical students receive pass predictions of 80% and 30%, and the first passes while the second fails. Their contributions are 0.80 and 0.70. Assuming outcomes are independent conditional on the inputs, their joint contribution is 0.80 × 0.70 = 0.56.
Software compares candidate coefficients using all the training observations, usually summing logarithms rather than multiplying many small numbers. It adjusts the shared coefficients jointly; it does not assign each student an independently chosen curve. Some fitting methods add a penalty to discourage extreme coefficients, so their objective differs from pure maximum likelihood.[1]
Choosing a Prediction Cutoff
A cutoff converts a probability into a class prediction. For this article, predict pass when p is at least the cutoff, including equality. A 50% cutoff is common, but the decision should reflect the consequences of mistakes.[4]
Suppose a school offers tutoring whenever predicted pass probability is below its required level. Compare a 50% requirement with an 80% requirement. Hold the following three hypothetical pass predictions fixed; only the cutoff changes:
| Predicted pass probability | 50% requirement | 80% requirement |
|---|---|---|
| 40% | Offer tutoring | Offer tutoring |
| 70% | No tutoring flag | Offer tutoring |
| 90% | No tutoring flag | No tutoring flag |
The 70% student changes groups even though the probability estimate stays the same. With fixed predictions, raising the pass requirement expands the tutoring group. It can flag students who would pass without help and may catch failures that the lower requirement would leave unflagged. You need observed outcomes to count those errors; probabilities alone do not supply a confusion matrix.
In the earlier study-hours rule, 50% corresponds to exactly three hours. An 80% threshold corresponds to h = 3 + ln(4) / 1.4 = about 3.99 hours, which the video rounds to four. Choose and assess a cutoff on suitable validation data rather than tuning it repeatedly to the training results.[4]
Logistic Regression vs. Linear Regression
Both models combine predictors using coefficients, but they place the linear relationship on different scales:
Ordinary linear regression
- Models a conditional mean directly with a linear expression.
- Commonly predicts quantities such as revenue or a return.
- Applied to a binary outcome, becomes the linear probability model and can produce out-of-range predictions.
Binary logistic regression
- Models log odds with a linear expression.
- Converts that expression into an event probability between zero and one.
- Uses a separate cutoff when a class label is needed.
A linear probability model can still be useful for some research questions; its limitations do not make it universally invalid. For technical comparisons with probit, coefficient inference and marginal effects, continue to the guide on logit and probit models.
A Finance Application: Flagging Default Risk
The same steps can support a financial review decision. Consider a toy loan model where Y = 1 means default in the next 12 months. Let d count late payments in the previous 12 months, information already available when scoring. Choose the illustrative score z = −3 + 0.5d; these are invented teaching coefficients, not actual lending estimates.
For d = 2, z = −3 + 0.5 × 2 = −2.
The predicted default probability is p = 1 / [1 + exp(2)] = 0.119203, or about 11.9%.
A hypothetical policy that flags cases with at least 10% predicted default risk would flag this loan for review; a 20% rule would not. Here the event is default, so a higher probability signals greater modeled risk. The example does not establish a valid lending policy or show that late payments cause default. Default probability also says nothing by itself about dollars lost if default occurs; see credit risk and probability of default for that broader framework.
How to Analyze a Logistic Regression Model
- Define the event and horizon. State what 1 means and when outcomes are measured. Passing one exam and defaulting within one year are specific targets.
- Check inputs and units. One study hour is different from ten hours; a ratio recorded as 0.30 is different from 30. Use only information available at prediction time.
- Separate fitting from evaluation. Learn coefficients and preprocessing from training data. Use appropriate held-out or cross-validation evidence to assess predictions and choose settings.[6]
- Check probability quality and decisions. Assess whether predicted risks agree with observed event rates, then examine missed events and false alarms at the proposed cutoff.[5]
To practice the score-to-probability calculation with supplied coefficients, use the logit and probit calculator. Calculating a model output is separate from showing that the model predicts well.
Common Mistakes
- Reading a coefficient as a probability change. A coefficient of 1.4 adds 1.4 to log odds; it does not add 140 percentage points to probability.
- Confusing odds with probability. Odds of 4 to 1 mean 4 / (4 + 1) = 80%, not 400%.
- Changing the event without changing the interpretation. A high pass probability and a high default probability call for different decisions.
- Treating a cutoff as a model fact. Two users can apply different cutoffs to the same probabilities because the costs of their mistakes differ.
- Judging only overall accuracy. If failures are rare, predicting pass for everyone can look accurate while missing every failure. Examine the errors that matter for the task.
Limitations of Logistic Regression
An S curve keeps probabilities within their mathematical bounds. It does not guarantee that a predicted 80% group will pass 80% of the time. Agreement between predicted probabilities and observed event frequencies is called calibration.[5]
The simple additive model assumes the chosen inputs enter linearly on the log-odds scale. Curvature or interactions may require a different specification. Observations also need an appropriate dependence treatment: repeated results from the same student or loans exposed to a common shock may not satisfy a simple independence assumption.
Limited data, unrepresentative samples and changing conditions can weaken predictions. With separation, predictors can perfectly divide observed passes from failures, and ordinary unpenalized maximum likelihood may have no finite coefficient estimates.[7]
Finally, fitted associations do not establish causation. Students who study more may also differ in prior knowledge or motivation. A regression prediction alone cannot isolate what would happen if you changed one student’s study time.
Frequently Asked Questions
Sources
- scikit-learn. Linear Models: Logistic regression. Model specification and fitting objective.
- UCLA Office of Advanced Research Computing. How do I interpret odds ratios in logistic regression? Probability, odds and log-odds interpretation.
- Keith Levin, University of Wisconsin–Madison. STAT340 Lecture 10: Logistic regression, November 2022. Maximum-likelihood mechanics.
- scikit-learn. Tuning the decision threshold for class prediction. Probability estimates, action rules and validation.
- scikit-learn. Probability calibration. Checking predicted probabilities against observed event frequencies.
- scikit-learn. Common pitfalls and recommended practices: Data leakage. Input timing and evaluation separation.
- SAS Institute. Existence of Maximum Likelihood Estimates, SAS/STAT 9.2 User’s Guide, 2009. Separation.
- UCLA Office of Advanced Research Computing. Logit Regression: R Data Analysis Examples. Numeric and categorical predictors.
Sources accessed November 12, 2026. All worked student and loan examples are hypothetical calculations.
Disclaimer
This article provides general statistical and financial education, not investment advice or lending recommendations. The chosen example coefficients and decision cutoffs are illustrative, do not represent actual student or borrower data, and have not been validated for real decisions.
Keep reading
More in Econometrics
-
What Is Econometrics? Data Types, Causality & the Empirical Process
Econometrics applies statistical methods to economic and financial data to estimate relationships, test theories, and evaluate decisions.
-
Simple Linear Regression: The OLS Method Explained
Learn simple linear regression and the OLS method. Understand the population model, slope and intercept interpretation, R-squared, and key assumptions…
-
Time Series Regression: Trends, Seasonality & Stationarity
Time series regression models dynamic relationships in financial and economic data. Learn what makes time series special, how to handle trends and seasonality…
