ε

Logit & Probit (Binary Outcomes)

Binary outcomes: the logistic model, odds ratios, marginal effects, classification.

Intermediate · 4 modules · Free and browser-based

View the course outline

Course overview

Learn Logit & Probit (Binary Outcomes) interactively

This free course uses real Python and statsmodels in your browser. Work through the modules below with explanations, executable examples, interactive controls, and questions.

1 · Why a linear model fails for 0/1 outcomes

When y is 0 or 1, fitting a straight line (the Linear Probability Model) breaks down: it predicts probabilities outside [0,1], has built-in heteroskedasticity, and imposes a constant effect that cannot be globally true.

2 · The logit (and probit) model

Logit and probit pass a linear index β₀+β₁x through an S-shaped link (the logistic CDF or the standard-normal CDF) to keep probabilities in (0,1). Both are fit by maximum likelihood; their coefficients differ only by a roughly constant scale factor.

3 · Interpreting coefficients: odds ratios & marginal effects

A raw logit coefficient is a change in log-odds — not very intuitive. Exponentiate it to get an odds ratio (a multiplicative effect on the odds), or compute a marginal effect dP/dx (the change in probability), which is largest near p=0.5 and shrinks at the extremes.

4 · Model fit & classification

Judge a binary model by likelihood-based fit (pseudo-R², LR test) and by classification: turn predicted probabilities into 0/1 at a threshold, build a confusion matrix, read accuracy, and trace the threshold-free ROC curve and its AUC — all with numpy, no sklearn.