gof {aods3}R 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 DD and the Pearson chi-squared X2X^2 statistics for the model under consideration. Let yy be the observed response, and E[y]=μE[y] = \mu and Var[y]Var[y] its mean and variance estimated from the model, statistic X2X^2 is calculated by:

X2=i((yiμ)2/Var[yi])X^2 = \sum_{i}( (y_i - \mu)^2/Var[y_i] )

Assuming that the data length is NN and the number of the parameters in the model is pp, eqnD and eqnX^2 are compared to a chi-squared distribution with NpN-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)

[Package aods3 version 0.4-1.2 Index]