HLTest: Display Hosmer-Lemeshow statistic and table of probabilities...

Description Usage Arguments Format Details Value Note Author(s) References See Also Examples

View source: R/HLTest.R

Description

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

Usage

1
HLTest(obj, g)

Arguments

obj

model name

g

number of groups

Format

x

The function has two arguments: model name, number of groups

Details

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

Value

list

Note

HLTest 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 Bilger and Loughlin for the use of their function.

Author(s)

Adapted from Loughlin, T.M. in Bilder and Loughlin, 2015

References

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

Bilder, C.R. and Loughlin, T.M. (2015), Analysis of Categorical Data with R, Chapman & Hall/CRC.

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

Hosmer, D.W., Lemeshow, S, and Sturdivant, R.X (2013), Applied Logistic Regression, 3rd ed, Wiley.

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)
grp10 <- HLTest(obj=mylogit, g=10)
cbind(grp10$observed, round(grp10$expect, digits = 1))
grp10

Example output

                Y0 Y1 Y0hat Y1hat
[0.0213,0.278] 101 52 117.7  35.3
(0.278,0.309]  104 42 102.9  43.1
(0.309,0.325]  112 45 107.2  49.8
(0.325,0.339]  109 37  97.2  48.8
(0.339,0.352]  119 42 105.0  56.0
(0.352,0.366]  137 54 121.8  69.2
(0.366,0.373]   79 20  62.1  36.9
(0.373,0.387]  140 60 123.4  76.6
(0.387,0.402]   61 81  85.5  56.5
(0.402,0.409]   20 80  59.1  40.9

	Hosmer and Lemeshow goodness-of-fit test with 10 bins

data:  mylogit
X2 = 124.84, df = 8, p-value < 2.2e-16

LOGIT documentation built on May 29, 2017, 10:26 a.m.

Related to HLTest in LOGIT...