Logistic Regression
The workhorse model for yes/no outcomes. It bends a linear score through an S-shaped curve so the output is always a sensible probability between 0 and 1, and reads out cleanly as odds.
Prerequisites: Ordinary Least Squares (OLS), Maximum Likelihood Estimation (MLE)
Ordinary regression predicts a number. But a huge share of real questions are yes/no: will this loan default? will the trade hit its profit target before its stop? did the click convert? For those, you don't want a raw number, you want a probability, something pinned between 0 and 1. Logistic regression is the standard, dependable way to get one.
The obvious fix, fit a straight line and call the output a probability, breaks immediately: a line runs off to and , so it happily predicts probabilities of or , which are nonsense. Logistic regression solves this by running the linear score through an S-shaped squashing curve (the logistic, or sigmoid, function) that gently flattens both ends so the output can never leave the range.
The model
You still build a linear score from your features, . Then you pass it through the logistic function to turn it into a probability:
Here is the predicted probability of a "yes", the s are the coefficients you fit, and s are your features. When the score is large and positive, is tiny and approaches ; when is very negative, approaches ; and at the probability is exactly . The relationship becomes perfectly linear if you look at it in the right units, the log-odds:
That is the key to reading the model: the coefficients are linear effects on the log-odds, not on the probability directly.
Logistic regression is linear in the log-odds: . The sigmoid just converts that score back into a probability that can never escape 0 to 1.
How it's fit and how to read a coefficient
There is no tidy closed-form formula like Ordinary Least Squares (OLS) has. Instead you fit by Maximum Likelihood Estimation (MLE): choose the s that make the observed yes/no outcomes most probable, found by a quick iterative solver. Once fit, each coefficient has a clean interpretation through the odds ratio. Increasing a feature by one unit multiplies the odds by . A coefficient of means each extra unit multiplies the odds of a "yes" by , it doubles the odds.
Worked example: probability of default
You model loan default with one feature, the borrower's debt-to-income ratio (as a decimal). The fit returns and . What's the default probability for a borrower with a debt-to-income ratio of ?
First the score: . Then the sigmoid:
So about a default probability. Bump the ratio to : the score becomes , and , now more likely than not to default. Notice the coefficient says every increase in debt-to-income adds to the log-odds, multiplying the odds by . Small changes near the middle of the curve swing the probability a lot; changes far out in the flat tails barely move it.
To turn any log-odds score into a probability in your head: if it's ; each roughly moves you toward the nearest edge (about at , at , at ). Symmetric for negatives.
Where it misleads
- Perfect separation. If some feature splits the classes cleanly (all defaults above a threshold, none below), the MLE tries to push a coefficient to infinity and the fit blows up. Regularization (Ridge and LASSO Regularization) or a prior tames it.
- Probabilities need calibration. A model can rank cases well (good AUC) yet output probabilities that are systematically too high or too low. If you'll act on the number, not just the ranking, check calibration before trusting it.
- Still a linear model at heart. It's linear in the log-odds, so it can't capture interactions or curved effects unless you engineer those features in. When the boundary is genuinely complex, tree ensembles or gradient boosting usually beat it.
- Imbalanced classes. Rare events (defaults, fraud) make the intercept dominate and accuracy misleading, a model predicting "never" can be accurate and useless. Weight the classes or use the right metric.
The output is a probability only if the model is calibrated. A high accuracy score can hide badly miscalibrated probabilities, especially with rare events. Always check that predicted probabilities match observed frequencies before betting on them.
Logistic regression is the honest first model for any classification problem: fast, interpretable, and hard to badly overfit. In quant workflows it's the natural engine for Meta-Labeling, deciding whether to act on a primary signal, and a clean baseline that fancier classifiers must beat to earn their complexity.
Related concepts
Practice in interviews
Further reading
- Hastie, Tibshirani & Friedman, The Elements of Statistical Learning (Ch. 4)
- Greene, Econometric Analysis (Ch. 17)
- Agresti, Categorical Data Analysis