Learn R Programming

LOGIT (version 1.3)

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

Description

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

Usage

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

Arguments

observed
response variable
predicted
predicted statistic
breaks
breaks or groups

Value

numeric

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).

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

Run this code
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)

Run the code above in your browser using DataLab