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

leo_wa kwngai6022 at hotmail.com
Fri Nov 7 14:31:53 CET 2008

```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.
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.
--
View this message in context: http://www.nabble.com/two-kind-of-Hosmer-and-Lemeshow%E2%80%99s-test-tp20380578p20380578.html
Sent from the R help mailing list archive at Nabble.com.

```