What is the Hosmer-Lemeshow goodness-of-fit test and what does it tell you about a logistic model?

Quick Overview

Explain the Hosmer-Lemeshow goodness-of-fit test for logistic regression: how observations are grouped, what the statistic compares and how to read its p-value. Tests your grasp of calibration, the test's sensitivity to group count and sample size, and what to report alongside it.

What is the Hosmer-Lemeshow goodness-of-fit test and what does it tell you about a logistic model?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

What is the Hosmer-Lemeshow goodness-of-fit test and what does it tell you about a logistic model? ```hint Start from what a probability promises If a model gives 100 people a predicted probability of about 0.3, how many of them should have the event? Think about how you would check that across the whole range of predictions. ``` ```hint Think about sample size Ask how the result of any significance test of fit changes when you have 200 rows compared with 2 million. ``` ### What a Strong Answer Covers - How observations are grouped and what is compared within each group - The form of the test statistic and its reference distribution, including the degrees of freedom - How to read a high or low p-value, and what a non-significant result does not prove - The test's sensitivity to the number of groups and to sample size - The difference between calibration and discrimination, and what to report alongside the test ### Follow-up Questions - With 2 million rows, the test rejects a model whose calibration plot looks almost perfect. What do you conclude, and what do you report instead? - Why are the degrees of freedom $G - 2$ for $G$ groups? - A model has an AUC of 0.85 but fails the Hosmer-Lemeshow test. How can both be true, and how would you fix the calibration?

Overview: Explain the Hosmer-Lemeshow goodness-of-fit test for logistic regression: how observations are grouped, what the statistic compares and how to read its p-value. Tests your grasp of calibration, the test's sensitivity to group count and sample size, and what to report alongside it.

General logo
General
Nov 24, 2026
mediumData ScientistOtherMachine Learning
0
0

What is the Hosmer-Lemeshow goodness-of-fit test and what does it tell you about a logistic model?

What a Strong Answer Covers Guidance

  • How observations are grouped and what is compared within each group
  • The form of the test statistic and its reference distribution, including the degrees of freedom
  • How to read a high or low p-value, and what a non-significant result does not prove
  • The test's sensitivity to the number of groups and to sample size
  • The difference between calibration and discrimination, and what to report alongside the test

Follow-up Questions Guidance

  • With 2 million rows, the test rejects a model whose calibration plot looks almost perfect. What do you conclude, and what do you report instead?
  • Why are the degrees of freedom G−2G - 2 for GG groups?
  • A model has an AUC of 0.85 but fails the Hosmer-Lemeshow test. How can both be true, and how would you fix the calibration?