Logistic Regression Setup and the Binary Response
You'll learn when to use logistic regression and how it fundamentally differs from linear regression.
When Linear Regression Breaks Down
Linear regression predicts continuous numeric outcomes (like house prices or temperatures). But what if your outcome is binary—yes/no, pass/fail, disease/no disease, 0 or 1?
If you tried to fit linear regression to binary data, you'd get predictions like 0.3, 1.7, or -0.5. These don't make sense for outcomes that must be exactly 0 or 1!
The Binary Response Variable
Logistic regression is designed specifically for binary outcomes. Your response variable Y takes only two values:
- Y = 1 (success, presence, yes)
- Y = 0 (failure, absence, no)
Examples:
- Customer clicked the ad (1) or didn't (0)
- Patient has disease (1) or healthy (0)
- Email is spam (1) or legitimate (0)
Core Difference from Linear Regression
Instead of predicting the actual outcome (which must be 0 or 1), logistic regression predicts the probability that Y = 1.
Think of it like this: Linear regression says "the house will cost $350,000." Logistic regression says "there's a 73% chance the customer will buy."
This probability is continuous (between 0 and 1), making it mathematically tractable. The logit link function you just learned transforms these probabilities into a scale where linear modeling works, then transforms back to give valid probabilities.
When to Choose Logistic Regression
Use logistic regression when:
- Your outcome is binary (two categories)
- You want probability estimates, not just classifications
- You need interpretable coefficients showing how predictors affect odds
Key Takeaway: Logistic regression is the go-to model for binary outcomes, predicting probabilities rather than raw values, using the logit link to connect linear predictors to valid probability estimates.