Learn R Programming

stats (version 3.6.2)

summary.aov: Summarize an Analysis of Variance Model

Description

Summarize an analysis of variance model.

Usage

# S3 method for aov
summary(object, intercept = FALSE, split,
        expand.split = TRUE, keep.zero.df = TRUE, …)

# S3 method for aovlist summary(object, …)

Arguments

object

An object of class "aov" or "aovlist".

intercept

logical: should intercept terms be included?

split

an optional named list, with names corresponding to terms in the model. Each component is itself a list with integer components giving contrasts whose contributions are to be summed.

expand.split

logical: should the split apply also to interactions involving the factor?

keep.zero.df

logical: should terms with no degrees of freedom be included?

…

Arguments to be passed to or from other methods, for summary.aovlist including those for summary.aov.

Value

An object of class c("summary.aov", "listof") or "summary.aovlist" respectively.

For fits with a single stratum the result will be a list of ANOVA tables, one for each response (even if there is only one response): the tables are of class "anova" inheriting from class "data.frame". They have columns "Df", "Sum Sq", "Mean Sq", as well as "F value" and "Pr(>F)" if there are non-zero residual degrees of freedom. There is a row for each term in the model, plus one for "Residuals" if there are any.

For multistratum fits the return value is a list of such summaries, one for each stratum.

See Also

aov, summary, model.tables, TukeyHSD

Examples

Run this code
# NOT RUN {
## For a simple example see example(aov)

# Cochran and Cox (1957, p.164)
# 3x3 factorial with ordered factors, each is average of 12.
CC <- data.frame(
    y = c(449, 413, 326, 409, 358, 291, 341, 278, 312)/12,
    P = ordered(gl(3, 3)), N = ordered(gl(3, 1, 9))
)
CC.aov <- aov(y ~ N * P, data = CC , weights = rep(12, 9))
summary(CC.aov)

# Split both main effects into linear and quadratic parts.
summary(CC.aov, split = list(N = list(L = 1, Q = 2),
                             P = list(L = 1, Q = 2)))

# Split only the interaction
summary(CC.aov, split = list("N:P" = list(L.L = 1, Q = 2:4)))

# split on just one var
summary(CC.aov, split = list(P = list(lin = 1, quad = 2)))
summary(CC.aov, split = list(P = list(lin = 1, quad = 2)),
        expand.split = FALSE)
# }

Run the code above in your browser using DataLab