gof | R Documentation |
The function returns a chi-squared test of goodness of fit for models of class glm
, aodml
or aodql
.
gof(object)
gof.default(object)
## S3 method for class 'gof'
print(x, ..., digits = max(3, getOption("digits") - 3))
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 |
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
, D
and X^2
are compared to a chi-squared distribution with N-p
degrees of freedom.
An object of class gof
, printed with print.gof
.
Agresti, A. Categorical data analysis. Wiley, 1990.
residuals
, chisq.test
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.