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

Frank E Harrell Jr f.harrell at vanderbilt.edu
Fri Nov 7 16:22:51 CET 2008


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.

Frank

> 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



More information about the R-help mailing list