Learn R Programming

finalfit (version 1.0.8)

metrics_hoslem: Hosmer-Lemeshow goodness of fit test

Description

Internal, not usually called directly

Usage

metrics_hoslem(y, yhat, g = 10, digits = c(2, 3))

Value

Character string of chi-sq result, df, and p-value. Significant p-value suggests poor fit.

Arguments

y

Observed y, usually of the form fit$y.

yhat

Predicted y_hat, usually for the form fit$fitted

g

Number of bins to calculate quantiles.

digits

Number of decimal places of form c(2,3), where digits[1] is for chi-sq estimate and digits[2] is for p-value.

Author

Adapted from Peter Solymos.

Examples

Run this code
fit = glm(mort_5yr~age.factor+extent.factor, data=colon_s, family="binomial")
metrics_hoslem(fit$y, fit$fitted)

Run the code above in your browser using DataLab