Learn R Programming

sjmisc (version 1.8)

hoslem_gof: 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:
  • chisq the Hosmer-Lemeshow chi-squared statistic
  • df degrees of freedom
  • p.value the p-value for the goodness-of-fit test

See Also

r2

Examples

Run this code
data(efc)

# goodness-of-fit test for logistic regression
efc$services <- dicho(efc$tot_sc_e, "v", 0, as.num = TRUE)
fit <- glm(services ~ neg_c_7 + c161sex + e42dep,
           data = efc,
           family = binomial(link = "logit"))
hoslem_gof(fit)

Run the code above in your browser using DataLab