| 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 |
x |
An object of class |
digits |
A numerical scalar indicating the number of digits to be printed after the decimal place. |
... |
Further arguments passed to |
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.
Value
An object of class gof, printed with print.gof.
References
Agresti, A. Categorical data analysis. Wiley, 1990.
See Also
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)