University of Technology Sydney · FACULTY OF BUSINESS ANALYTICS

22576 Chap.11 Logistic Regression and the Confusion Matrix

- one subject, every graph, every model, every mark
6 Chapters4-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 11 of 11 · 22576

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.

In this chapter

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

Q [5 marks]. On holdout data a churn model gives TP = 120, FN = 30, FP = 40 and TN = 810 for 1,000 customers. Compute accuracy, precision, recall and specificity, and say which metric to lead with if missed churners are the costly error. The marks used here are AskSia's study allocation and are not the official University scheme.
The worked example's confusion matrix for 1,000 customers: the diagonal holds the 930 correct predictions, while 30 churners were missed and 40 loyal customers The worked example's confusion matrix for 1,000 customers: the diagonal holds the 930 correct predictions, while 30 churners were missed and 40 loyal customers were wrongly flagged, and the darker the cell the larger its count.TP 120FN 30FP 40TN 810Predicted churnPredicted stayActual churnActual stay
The worked example's confusion matrix for 1,000 customers: the diagonal holds the 930 correct predictions, while 30 churners were missed and 40 loyal customers were wrongly flagged, and the darker the cell the larger its count.
  • 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.
Accuracy 93.0%, precision 75.0%, recall 80.0%, specificity 95.3%; recall matters most here.
Sia tip — Before dividing, check that each row of the matrix sums to the actual class size; a transposed matrix swaps precision and recall.
Glossary

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.
FAQ

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.

Study strategy

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.

A+Everything unlocked
Unlocks this Bible + all 35 of your University of Technology Sydney subjects - and 1,000+ Bibles across every Australian university.
Sia - your 22576 tutor, unlimited, worked the way the exam marks it
The full 4-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works