gof: Test of Goodness-of-Fit of Models for Count data

View source: R/gof.R

gofR Documentation

Test of Goodness-of-Fit of Models for Count data

Description

The function returns a chi-squared test of goodness of fit for models of class glm, aodml or aodql.

Usage

  gof(object)
  gof.default(object)
  
  ## S3 method for class 'gof'
print(x, ..., digits =  max(3, getOption("digits") - 3))
  

Arguments

object

An object of class glm, aodml or aodquasi.

x

An object of class gof.

digits

A numerical scalar indicating the number of digits to be printed after the decimal place.

...

Further arguments passed to print.

Details

Function gof calculates the deviance D and the Pearson chi-squared X^2 statistics for the model under consideration. Let y be the observed response, and E[y] = μ and Var[y] its mean and variance estimated from the model, statistic X^2 is calculated by:

X^2 = ∑_{i}( (y_i - μ)^2/Var[y_i] )

Assuming that the data length is N and the number of the parameters in the model is p, eqnD and eqnX^2 are compared to a chi-squared distribution with N-p degrees of freedom.

Value

An object of class gof, printed with print.gof.

References

Agresti, A. Categorical data analysis. Wiley, 1990.

See Also

residuals, chisq.test

Examples

data(orob2)
fm1 <- glm(cbind(m, n - m) ~ seed, data = orob2, family = binomial)
fm2 <- aodml(cbind(m, n - m) ~ seed, data = orob2, family = "bb")
gof(fm1)
gof(fm2)

aods3 documentation built on July 8, 2022, 5:06 p.m.

Related to gof in aods3...