Module 10 Activity
Scenario
Model a binary outcome and report it in probabilities a reader can use.
What you build
A logistic regression with odds ratios, predicted probabilities and a justified threshold.
Steps
- Confirm the outcome is binary and check what a linear model would predict at the extremes of your predictor.
- Fit with
smf.logitand verify the output reports log-likelihood and a z statistic. - Exponentiate the coefficients and the bounds of
conf_int(), label them as odds ratios, and give the baseline rate. - Produce predicted probabilities with
get_prediction(grid).summary_frame()so the intervals stay in [0, 1]. - Report the confusion matrix against the majority-class baseline and say how many positives were caught.
- Check calibration by binning predictions against observed rates, then choose a threshold from the relative cost of misses and false alarms.
Evidence to hand in
- What a linear model predicted, and where it went out of range.
- The fitted model with its log-likelihood.
- The odds-ratio table with the baseline rate.
- The predicted-probability table with intervals.
- The confusion matrix against the majority baseline.
- The calibration check and your threshold justification.
Review checklist
smf.logitwas used, notsmf.ols.- Odds ratios are labelled as such and the baseline rate is given.
- Predicted-probability intervals came from
summary_frame(), not from converting endpoints by hand. - Accuracy is compared to the majority-class rate, not to 50%.
- The threshold is justified by costs, not left at 0.5 by default.
