{"schemaVersion":2,"id":"logit","title":"Logit & Probit (Binary Outcomes)","totalStages":32,"modules":[{"id":"logit-why-lpm-fails","title":"1 · Why a linear model fails for 0/1 outcomes","summary":"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.","stageCount":7,"stages":[{"id":"logit-why-lpm-fails-01","index":0,"moduleId":"logit-why-lpm-fails","moduleIndex":0,"type":"read","title":"Binary outcomes and the urge to run OLS","skillIds":["logit.lpm-limits"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-why-lpm-fails-02","index":1,"moduleId":"logit-why-lpm-fails","moduleIndex":1,"type":"read","title":"Three things that go wrong","skillIds":["logit.binary-links"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-why-lpm-fails-03","index":2,"moduleId":"logit-why-lpm-fails","moduleIndex":2,"type":"code","title":"Watch the LPM predict impossible probabilities","skillIds":["logit.lpm-limits"],"estimatedMinutes":10,"difficulty":"applied","points":10},{"id":"logit-why-lpm-fails-04","index":3,"moduleId":"logit-why-lpm-fails","moduleIndex":3,"type":"interactive","title":"How far out of bounds does the line go?","skillIds":["logit.binary-links"],"estimatedMinutes":8,"difficulty":"applied","points":10},{"id":"logit-why-lpm-fails-05","index":4,"moduleId":"logit-why-lpm-fails","moduleIndex":4,"type":"quiz","title":"Check","skillIds":["logit.lpm-limits"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-why-lpm-fails-06","index":5,"moduleId":"logit-why-lpm-fails","moduleIndex":5,"type":"quiz","title":"Check","skillIds":["logit.binary-links"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-why-lpm-fails-07","index":6,"moduleId":"logit-why-lpm-fails","moduleIndex":6,"type":"truefalse","title":"Does a straight line have a constant effect?","skillIds":["logit.lpm-limits"],"estimatedMinutes":3,"difficulty":"applied","points":10}]},{"id":"logit-the-model","title":"2 · The logit (and probit) model","summary":"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.","stageCount":8,"stages":[{"id":"logit-the-model-01","index":7,"moduleId":"logit-the-model","moduleIndex":0,"type":"read","title":"Squash the line through an S-curve","skillIds":["logit.binary-mle"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-the-model-02","index":8,"moduleId":"logit-the-model","moduleIndex":1,"type":"read","title":"The logit's special trick: log-odds are linear","skillIds":["logit.odds-ratios"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-the-model-03","index":9,"moduleId":"logit-the-model","moduleIndex":2,"type":"code","title":"Fit logit, recover the truth, and compare to probit","skillIds":["logit.binary-mle"],"estimatedMinutes":10,"difficulty":"applied","points":10},{"id":"logit-the-model-04","index":10,"moduleId":"logit-the-model","moduleIndex":3,"type":"interactive","title":"Shape the S-curve by hand","skillIds":["logit.odds-ratios"],"estimatedMinutes":8,"difficulty":"applied","points":10},{"id":"logit-the-model-05","index":11,"moduleId":"logit-the-model","moduleIndex":4,"type":"quiz","title":"Check","skillIds":["logit.binary-mle"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-the-model-06","index":12,"moduleId":"logit-the-model","moduleIndex":5,"type":"quiz","title":"Check","skillIds":["logit.odds-ratios"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-the-model-07","index":13,"moduleId":"logit-the-model","moduleIndex":6,"type":"truefalse","title":"Is the coefficient a probability change?","skillIds":["logit.binary-mle"],"estimatedMinutes":3,"difficulty":"applied","points":10},{"id":"logit-the-model-08","index":14,"moduleId":"logit-the-model","moduleIndex":7,"type":"fillblank","title":"What does the logit make linear?","skillIds":["logit.odds-ratios"],"estimatedMinutes":4,"difficulty":"applied","points":15}]},{"id":"logit-interpreting-coefficients","title":"3 · Interpreting coefficients: odds ratios & marginal effects","summary":"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.","stageCount":9,"stages":[{"id":"logit-interpreting-coefficients-01","index":15,"moduleId":"logit-interpreting-coefficients","moduleIndex":0,"type":"read","title":"Three currencies for the same effect","skillIds":["logit.marginal-effects"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-interpreting-coefficients-02","index":16,"moduleId":"logit-interpreting-coefficients","moduleIndex":1,"type":"read","title":"Reading the numbers correctly","skillIds":["logit.classification"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-interpreting-coefficients-03","index":17,"moduleId":"logit-interpreting-coefficients","moduleIndex":2,"type":"code","title":"Odds ratios and average marginal effects","skillIds":["logit.marginal-effects"],"estimatedMinutes":10,"difficulty":"applied","points":10},{"id":"logit-interpreting-coefficients-04","index":18,"moduleId":"logit-interpreting-coefficients","moduleIndex":3,"type":"interactive","title":"See the marginal effect change along the curve","skillIds":["logit.classification"],"estimatedMinutes":8,"difficulty":"applied","points":10},{"id":"logit-interpreting-coefficients-05","index":19,"moduleId":"logit-interpreting-coefficients","moduleIndex":4,"type":"quiz","title":"Check","skillIds":["logit.marginal-effects"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-interpreting-coefficients-06","index":20,"moduleId":"logit-interpreting-coefficients","moduleIndex":5,"type":"quiz","title":"Check","skillIds":["logit.classification"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-interpreting-coefficients-07","index":21,"moduleId":"logit-interpreting-coefficients","moduleIndex":6,"type":"numeric","title":"Turn the coefficient into an odds ratio","skillIds":["logit.marginal-effects"],"estimatedMinutes":5,"difficulty":"applied","points":20},{"id":"logit-interpreting-coefficients-08","index":22,"moduleId":"logit-interpreting-coefficients","moduleIndex":7,"type":"numeric","title":"The marginal effect at p = 0.5","skillIds":["logit.classification"],"estimatedMinutes":5,"difficulty":"applied","points":20},{"id":"logit-interpreting-coefficients-09","index":23,"moduleId":"logit-interpreting-coefficients","moduleIndex":8,"type":"multi","title":"Reading a logit coefficient — select all","skillIds":["logit.marginal-effects"],"estimatedMinutes":5,"difficulty":"applied","points":20}]},{"id":"logit-fit-and-classification","title":"4 · Model fit & classification","summary":"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.","stageCount":8,"stages":[{"id":"logit-fit-and-classification-01","index":24,"moduleId":"logit-fit-and-classification","moduleIndex":0,"type":"read","title":"Two ways to ask 'is it any good?'","skillIds":["logit.calibration"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-fit-and-classification-02","index":25,"moduleId":"logit-fit-and-classification","moduleIndex":1,"type":"read","title":"Why one threshold is not enough: ROC & AUC","skillIds":["logit.calibration"],"estimatedMinutes":6,"difficulty":"applied","points":5},{"id":"logit-fit-and-classification-03","index":26,"moduleId":"logit-fit-and-classification","moduleIndex":2,"type":"code","title":"Confusion matrix, accuracy, and a hand-rolled ROC/AUC","skillIds":["logit.calibration"],"estimatedMinutes":10,"difficulty":"applied","points":10},{"id":"logit-fit-and-classification-04","index":27,"moduleId":"logit-fit-and-classification","moduleIndex":3,"type":"interactive","title":"Move the threshold, trade off the two errors","skillIds":["logit.calibration"],"estimatedMinutes":8,"difficulty":"applied","points":10},{"id":"logit-fit-and-classification-05","index":28,"moduleId":"logit-fit-and-classification","moduleIndex":4,"type":"quiz","title":"Check","skillIds":["logit.calibration"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-fit-and-classification-06","index":29,"moduleId":"logit-fit-and-classification","moduleIndex":5,"type":"quiz","title":"Check","skillIds":["logit.calibration"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-fit-and-classification-07","index":30,"moduleId":"logit-fit-and-classification","moduleIndex":6,"type":"quiz","title":"Check","skillIds":["logit.calibration"],"estimatedMinutes":5,"difficulty":"applied","points":15},{"id":"logit-fit-and-classification-08","index":31,"moduleId":"logit-fit-and-classification","moduleIndex":7,"type":"truefalse","title":"Does 95% accuracy mean a good model?","skillIds":["logit.calibration"],"estimatedMinutes":3,"difficulty":"applied","points":10}]}]}
