| hoslem.test {ResourceSelection} | R Documentation | 
Hosmer-Lemeshow Goodness of Fit (GOF) Test
Description
Hosmer-Lemeshow Goodness of Fit (GOF) Test.
Usage
hoslem.test(x, y, g = 10)
Arguments
x | 
 a numeric vector of observations, binary (0/1).  | 
y | 
 expected values.  | 
g | 
 number of bins to use to calculate quantiles.
Needs to be at least 2. The degrees of freedom of the test is   | 
Details
The Hosmer-Lemeshow test is a statistical test for goodness of fit for logistic regression models.
Value
A list with class "htest" containing the following components: 
statistic | 
 the value of the chi-squared test statistic,
(  | 
parameter | 
 the degrees of freedom of the approximate 
chi-squared distribution of the test statistic (  | 
p.value | 
 the p-value for the test.  | 
method | 
 a character string indicating the type of test performed.  | 
data.name | 
 a character string giving the name(s) of the data.  | 
observed | 
 the observed frequencies in a   | 
expected | 
 the expected frequencies in a   | 
Author(s)
Peter Solymos by adapting code pieces from R help mailing list
References
Hosmer D W, Lemeshow S 2000. Applied Logistic Regression. New York, USA: John Wiley and Sons.
Examples
set.seed(123)
n <- 500
x <- rnorm(n)
y <- rbinom(n, 1, plogis(0.1 + 0.5*x))
m <- glm(y ~ x, family=binomial)
hoslem.test(m$y, fitted(m))