**Hosmer and Lemeshow Test (HL)**

It measures the association between actual events and predicted probability. In other words, it is a measure of how close the predicted probabilities are to the actual rate of events.

In HL test, null hypothesis states that sample of observed events and non-events supports the claim about the predicted events and non-events. In other words, the model fits data well.

**Calculation**

- Calculate estimated probability of events
- Split data into 10 sections based on ascending order of probability
- Calculate number of actual events and non-events in each section
- Calculate Predicted Probability = 1 by averaging probability in each section
- Calculate Predicted Probability = 0 by subtracting Predicted Probability=1 from 1
- Calculate expected frequency by multiplying number of cases by Predicted Probability = 1
- Calculate chi-square statistics taking frequency of observed (actual) and predicted events and non-events

Hosmer Lemeshow Test |

Rule: If p-value > .05. the model fits data well.

**Calculate Hosmer Lemeshow Test with Excel**

HI Deepanshu I was looking at the attached excel for HL in excel. In the column H, you do an average of all probability (irrespective of dependent variable =0 or 1) and then put that average value in Column I. I was wondering if that is the correct way or we need to filter only those probabilities where dependent variable =1 and then average those probabilities?

ReplyDeleteThis is the correct way. Thanks!

Delete