22576 Chap.11 Logistic Regression and the Confusion Matrix
Logistic Regression and the Confusion Matrix
Week 8 moves to categorical outcomes. This chapter explains odds and log-odds, the logistic regression equation and how a 0/1 explanatory variable's coefficient converts into a percentage change in the odds, and how multinomial models handle more than two categories.
It then evaluates classifiers with the confusion matrix, Type I and Type II errors, and accuracy, precision, recall, the F-measure and specificity, including how to choose which metric to report.
Classification is likely to feature in the individual report, because the case asks which leads are most likely to convert, a yes-or-no outcome.
Reporting a classifier well means stating the probability or odds effect of the key variables, presenting the confusion matrix on holdout data, and choosing the metric that matches the business cost of each kind of error.
What this chapter covers
- 01
Classification models for categorical outcomes
- 02
Odds, log-odds and the logistic curve
- 03
Converting a 0/1 coefficient to a change in odds
- 04
Multinomial logistic regression
- 05
The confusion matrix and Type I and II errors
- 06
Accuracy, precision, recall, F-measure and specificity
Worked example · free
Score a churn model from its confusion matrix
- 1Accuracy: (120 + 810) ÷ 1,000 = 93.0%.
- 1Precision: 120 ÷ (120 + 40) = 75.0% of predicted churners actually churned.
- 1Recall: 120 ÷ (120 + 30) = 80.0% of actual churners were caught.
- 1Specificity: 810 ÷ (810 + 40) = 95.3% of stayers were correctly cleared.
- 1Missed churners are false negatives, so lead with recall.
Key terms
- Odds
- The probability an event happens divided by the probability it does not, p ÷ (1 − p).
- Log-odds
- The natural logarithm of the odds, the quantity a logistic regression models linearly.
- Precision
- Of all cases predicted positive, the share that were actually positive.
- Recall
- Of all actual positive cases, the share the model predicted positive; also called sensitivity.
- Specificity
- Of all actual negative cases, the share the model correctly predicted negative.
- Classification model
- A model that predicts a categorical outcome from a set of explanatory variables.
Logistic Regression and the Confusion Matrix FAQ
How do I interpret a logistic coefficient for a 0/1 variable?
Convert it into a percentage change in the odds with (e^b − 1) × 100%. A coefficient of 1.20 gives about 232%, so the odds of the event are about 232% higher when the variable equals 1 than when it equals 0, holding other variables constant.
Why can a model with high accuracy still be poor?
When one class dominates, predicting the common class almost every time gives high accuracy while missing most of the rare cases that matter. Recall and precision expose this, which is why the class balance and the business cost of each error should guide which metric is reported.
How does the workshop compute the F-measure?
As the simple average of precision and recall. Many references instead use the harmonic mean, 2 × precision × recall ÷ (precision + recall), which gives a slightly lower value. Use the definition the question follows and name the formula in your answer so the marker can follow your working.
What are Type I and Type II errors in a classification model?
A Type I error flags something that is not there, such as marking a safe transaction as fraud, and appears as a false positive. A Type II error misses something that is there, such as letting a fraudulent transaction through, and appears as a false negative. The workshop expresses each as a share of all predictions.
How does multinomial logistic regression work?
When the outcome has more than two categories, one category is chosen as the reference and a separate log-odds equation is estimated for each other category against it. With website as the reference, a purchase-channel model has one equation for in store versus website and one for app versus website.
What does an odds value below 1 mean?
It means the event is less likely to happen than not. Odds of 0.25 correspond to a probability of 0.2, because 0.2 divided by 0.8 is 0.25. Odds of exactly 1 mean even chances, and odds above 1 mean the event is more likely than not.
Assessment move
Draw a blank confusion matrix with rows for actual classes and columns for predicted ones, then practise filling it from a scenario and computing all five metrics. Rehearse the odds conversion with a calculator, since Quiz 3 includes calculation questions. Finish by explaining, in two sentences, which metric you would report for a lead-conversion model and why.
Working through Logistic Regression and the Confusion Matrix in 22576? Sia is AskSia’s AI Business Analytics tutor — ask any 22576 Logistic Regression and the Confusion Matrix question and get a clear, step-by-step explanation grounded in how 22576 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.