aods3 (version 0.4-1.1)

gof: 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 gof
print(x, ..., digits =  max(3, getOption("digits") - 3))

Value

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

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] = \mu\) and \(Var[y]\) its mean and variance estimated from the model, statistic \(X^2\) is calculated by:

$$X^2 = \sum_{i}( (y_i - \mu)^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.

References

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

See Also

Examples

Run this code
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)

Run the code above in your browser using DataLab