Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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))

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.

Value

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

Author(s)

Adapted from Peter Solymos.

Source

https://github.com/psolymos/ResourceSelection/blob/master/R/hoslem.test.R

Examples

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

finalfit

Quickly Create Elegant Regression Results Tables and Plots when Modelling

v1.0.2
MIT + file LICENCE
Authors
Ewen Harrison [aut, cre], Tom Drake [aut], Riinu Ots [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.