Re: [R] two kind of Hosmer and Lemeshow’s test

From: Frank E Harrell Jr <>
Date: Fri, 07 Nov 2008 09:22:51 -0600

leo_wa wrote:
> I know that there are two method to apply the Hosmer and Lemeshow’s. One of
> them is calculated based on the fixed and pre-determined cut-off points of
> the estimated probability of success. One of them is calculated based on
> the percentiles of estimated probabilities.

Both of these methods have been made obsolete by methods that do not require any arbitrary groupings of predicted probabilities. See the residuals.lrm function in the Design package and the reference in its help file, to the Hosmer paper.


> In the previous post,i find that the Hosmer and Lemeshow’s test how to use
> in R.
> hosmerlem <-
> function (y, yhat, g = 10)
> {
> cutyhat <- cut(x, breaks = quantile(yhat, probs = seq(0,
> 1, 1/g)), include.lowest = T)
> obs <- xtabs(cbind(1 - y, y) ~ cutyhat)
> expect <- xtabs(cbind(1 - yhat, yhat) ~ cutyhat)
> chisq <- sum((obs - expect)^2/expect)
> P <- 1 - pchisq(chisq, g - 2)
> c("X^2" = chisq, Df = g - 2, "P(>Chi)" = P)
> }
> I want to know how can i use the another method which is not use the
> probability of success. i want to know how can i revise above program to
> achieve an objective.

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 07 Nov 2008 - 22:38:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Nov 2008 - 23:30:22 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive