Compute an Anova Table - Generic function

DESCRIPTION:

Produces an object of class anova, which inherits from data.frame or bdFrame.

This function is an S Version 3 generic (see Methods); method functions can be written to handle specific S Version 3 classes of data. Classes that already have methods for this function include: bdGlm, bdLm, gam, gamlist, glm, glmlist, lm, lmlist, loess, survreg, and survreglist.

USAGE:

anova(object, ...) 

REQUIRED ARGUMENTS:

object
a model object, such as those produced by bdGlm, bdLm, lm, glm, aov, loess, and survreg.

OPTIONAL ARGUMENTS:

...
some methods may have additional arguments. In particular, many have a test argument with choices such as "none", "F", "Chi", "Cp".

VALUE:

an anova object. This class of objects inherits from the class "data.frame" or "bdFrame", and consequently, suitable methods exist for printing, subsetting, and so on. An additional "heading" attribute is a character vector that is printed at the top of the table.

DETAILS:

If called with a single object as an argument, anova produces a table with rows corresponding to each of the terms in the object, plus an additional row for the residuals. The method for aov objects is similar to summary.

When two or more objects are used in the call, a similar table is produced showing the effects of the pairwise differences between the models, considered sequentially from first to last.

REFERENCES:

Chambers, J.M., and Hastie, T.J. (1991). Statistical Models in S. London: Chapman and Hall.

SEE ALSO:

(to perform analysis of variance modeling), , .

EXAMPLES:

# Create a sample glm object. 
glm.object <- glm(Kyphosis ~ bs(Start, 5) + Number, family = binomial, 
                  data = kyphosis) 
anova(glm.object) 

# Produces the following output:
# 
# Analysis of Deviance Table 
#
# Binomial model 
#
# Response: Kyphosis 
#
# Terms added sequentially (first to last) 
#              Df    Deviance Resid. Df Resid. Dev  
#         NULL                       80   83.23447 
# bs(Start, 5)  5    23.52054        75   59.71394 
#       Number  1     1.71619        74   57.99775 

# Create two more sample objects from ethanol dataset: 
gas.null <- loess(NOx ~ E, span = 1, data = gas) 
gas.alternative <- loess(NOx ~ E, span = 2/3, data = gas) 
anova(gas.null, gas.alternative) 

# Produces the following output:
#
# Model 1:  
# loess(formula = NOx ~ E, data = gas, span = 1) 
# Model 2:  
# loess(formula = NOx ~ E, data = gas, span = 2/3) 
# Analysis of Variance Table 
#         Enp      RSS     Test     F Value         Pr(F) 
# 1       3.5     4.8489   1 vs 2     10.14     0.0008601 
# 2       5.5     1.7769