hoslem_gof {sjstats}R Documentation

Hosmer-Lemeshow Goodness-of-fit-test

Description

This method performs a Hosmer-Lemeshow goodness-of-fit-test for generalized linear (mixed) models for binary data.

Usage

hoslem_gof(x, g = 10)

Arguments

x

Fitted glm or glmer model.

g

Number of bins to divide the data. Default is 10.

Value

An object of class hoslem_test with following values:

Note

A well-fitting model shows no significant difference between the model and the observed data, i.e. the reported p-value should be greater than 0.05.

References

Hosmer, D. W., & Lemeshow, S. (2000). Applied Logistic Regression. Hoboken, NJ, USA: John Wiley & Sons, Inc. doi: 10.1002/0471722146

See Also

r2

Examples

data(efc)
# goodness-of-fit test for logistic regression
efc$services <- ifelse(efc$tot_sc_e > 0, 1, 0)
fit <- glm(services ~ neg_c_7 + c161sex + e42dep, data = efc,
           family = binomial(link = "logit"))
hoslem_gof(fit)


[Package sjstats version 0.14.2-3 Index]