Hosmer-Lemeshow Chi-Squared Test

The Hosmer-Lemeshow \(\chi^2\) value is calculated by grouping the observation into \(g\) groups based percentiles of the predicted probabilities,

\[HL = \sum_{j=1}^{g} \frac{(O_j-n_j \bar{\pi}_j)^2}{n_j \bar{\pi}_j (1 - \bar{\pi}_j)}\]

where \(n_j\) is the number of observations, \(O_j\) is the number of observed successes, and \(\bar{\pi}_j\) is the the estimated success probability in the \(j^{th}\) Hosmer-Lemeshow group.

The number of Hosmer-Lemeshow percentile groups \(g\) is typically \(10\) (deciles) but can be lower if the there are fewer replicate groups or greater than \(10\) parameters \(p\) in the model. The quantiles are computed using the method recommended by Hyndman and Fan in their 1996 paper (see Bibliography below).

The degrees of freedom for the test is the number of Hosmer-Lemeshow groups minus 2, \(df = g - 2\).

There is evidence of poor fit if \(HL/(g-p)\) differs significantly from 1 or the p-value is less than the \(\alpha\)-risk.

Use the Hosmer-Lemeshow test when the design contains no replicates or when there are replicate groups with few replicates.

References

  • David W. Hosmer and Stanley Lemeshow. Applied Logistic Regression. Wiley, New York, second edition, 2000.

  • Rob J. Hyndman and Yanan Fan. Quantiles in statistical packages. The American Statistician, 50(4):361–365, 1996.

  • Douglas C. Montgomery, Peck, Elizabeth A., and G. Geoffrey Vining. Introduction to Linear Regression Analysis. Wiley, 5th edition, 2012.