Learn R Programming

sjmisc (version 1.0.2)

hoslem_gof: Performs a Hosmer-Lemeshow Goodness-of-fit-test

Description

This method performs a Hosmer-Lemeshow goodness-of-fit-test for glms or glmers for binary data.

Usage

hoslem_gof(x, g = 10)

Arguments

x
a fitted glm or glmer.
g
number of bins to divide the data Default is 10.

Value

  • An object of class hoslem_test with following values:
    • chisqthe Hosmer-Lemeshow chi-squared statistic
    • dfdegrees of freedom
    • p.valuethe p-value for the goodness-of-fit test

See Also

pseudo_r2

Examples

Run this code
data(efc)

# goodness-of-fit test for logistic regression
efc$services <- dicho(efc$tot_sc_e, "v", 0, asNum = 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