hoslem_test {psfmi} | R Documentation |
Calculates the Hosmer and Lemeshow goodness of fit test.
Description
hoslem_test
the Hosmer and Lemeshow goodness of fit test.
Usage
hoslem_test(y, yhat, g = 10)
Arguments
y |
a vector of observations (0/1). |
yhat |
a vector of predicted probabilities. |
g |
Number of groups tested. Default is 10. Can not be < 3. |
Value
The Chi-squared test statistic, the p-value, the observed and expected frequencies.
Author(s)
Martijn Heymans, 2021
References
Kleinman K and Horton NJ. (2014). SAS and R: Data Management, Statistical Analysis, and Graphics. 2nd Edition. Chapman & Hall/CRC.
See Also
Examples
fit <- glm(Mortality ~ Dementia + factor(Mobility) + ASA +
Gender + Age, data=hipstudy, family=binomial)
pred <- predict(fit, type = "response")
hoslem_test(fit$y, pred)
[Package psfmi version 1.4.0 Index]