Hosmer-Lemeshow Goodness of Fit (GOF) Test
hoslem.test.Rd
Hosmer-Lemeshow Goodness of Fit (GOF) Test.
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
g-2
but the number of bins might also depend on the data (i.e. due to identical quantile values that lead to empty bins). In case when the number of bins does not equalg
, the degrees of freedom will depend on the number of bins that is less thang
. In such case a warning is produced.
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, (
sum((observed - expected)^2 / expected)
).- parameter
the degrees of freedom of the approximate chi-squared distribution of the test statistic (
g - 2
).- 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
g
-by-2 contingency table.- expected
the expected frequencies in a
g
-by-2 contingency table.