Hosmer-lemeshow goodness-of-fit statistics for blm and lexpit objects.

Share:

Description

Computes the deviance and Pearson chi-squared statistics for the fit from a blm or lexpit model. These tests are appropriate when all predictors are categorical and there are many replicates within each covariate class.

Value

Returns a list with table, with expected E and observed O, and the chi-square test chisq and p-value (p.value) for the Pearson goodness-of-fit test. The observed and expected count are listed in the order of the unique levels formed by the design matrix.

When sample weights are present, the goodness-of-fit test is a modified F-test as suggested by Archer et al. (2007).

usage

gof(object)

arguments

object

instance of blm or lexpit

Author(s)

Stephanie Kovalchik s.a.kovalchik@gmail.com

References

Archer KJ, Lemeshow S, Hosmer DW. Goodness-of-fit tests for logistic regression models when data are collected using a complex sampling design. Computational Statistics & Data Analysis. 2007;51:4450–4464.

See Also

blm, lexpit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(ccdata)

ccdata$packyear <- ccdata$packyear+runif(nrow(ccdata))

# UNWEIGHTED GOF
fit <- blm(y~female+packyear,data = ccdata)
gof(fit)

# WEIGHTED GOF
fit <- blm(y~female+packyear,data = ccdata, weight = ccdata$w)
gof(fit)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.