Display Hosmer-Lemeshow statistic and table of probabilities following logistic regression using glm with binomial family.

Share:

Description

Provides a Hosmer-Lemeshow statistic and table following logistic regression.

Usage

1
hlGOF.test(observed, predicted, breaks = 15)

Arguments

observed

response variable

predicted

predicted statistic

breaks

breaks or groups

Format

x

The function has three arguments: observed term, predicted values, # groups

Details

hlGOF.test is a post-estimation function for logistic regression, following the use of glm(). Usage displays a table of observed vs predicted groups and an overall H-L goodness-of-fit statistic. The test is originally from Hilbe (2009).

Value

numeric

Note

hlGOF.test must be loaded into memory in order to be effectve. As a function in LOGIT, it is immediately available to a user. My thanks to Prof. Robert LaBudde for the initial version of this function.

Author(s)

Joseph M. Hilbe, Arizona State University, Robert LaBudde, Institute for Statisical Education (Statistics.com), provided initial code for this function for Hilbe, Logistic Regression Models, text.

References

Hilbe, J. M. (2015), Practical Guide to Logistic Regression, Chapman & Hall/CRC.

Hilbe, J. M. (2009), Logistic Regression Models, Chapman & Hall/CRC.

See Also

glm

Examples

1
2
3
4
5
6
7
library(MASS)
library(LOGIT)
data(medpar)
mylogit <- glm( died ~  los + white + hmo, family=binomial, data=medpar)
summary(mylogit)
medpar2 <- na.omit(medpar)
hlGOF.test(medpar2$died, predict(mylogit,medpar2, type="response"), breaks=12)