The Hosmer-Lemeshow Goodness-of-Fit Test
Computes the Hosmer-Lemeshow goodness-of-fit test for a generalized linear model fitted to binary responses.
hltest(model, verbose = TRUE, ...)
model |
an object of the class glm which is obtained from the fit of a generalized linear model where the distribution for the response variable is assumed to be binomial. |
verbose |
an (optional) logical switch indicating if should the report of results be printed. By default, |
... |
further arguments passed to or from other methods. |
A list which contains the following objects:
hm:
A matrix with the values of Group, Size, Observed and Expected, which are required to compute the statistic of the test.
statistic:
The value of the statistic of the test.
df:
The number of degrees of freedom, given by the number of groups minus 2.
p.value:
The p-value of the test computed using the Chi-square distribution.
Hosmer, D.W. and Lemeshow, S. (2000) Applied Logistic Regression. 2nd ed. John Wiley & Sons, New York.
## Example 1 fit1 <- glm(cancer/exposed ~ dose, weights=exposed, family=binomial("logit"), data=bladder) hltest(fit1) ## Example 2 fit2 <- glm(cancer/exposed ~ dose, weights=exposed, family=binomial("logit"), data=liver) hltest(fit2) ## Example 3 burn1000 <- aplore3::burn1000 mod <- death ~ age + tbsa + inh_inj + age*inh_inj + tbsa*inh_inj fit3 <- glm(mod, family=binomial("logit"), data=burn1000) hltest(fit3)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.