Make nice ANOVA table for printing.

Description

These functions produce a nice ANOVA table best for prointing. nice.anova takes an object from Anova possible created by the convenience functions ez.glm or aov.car. When within-subject factors are present, either sphericity corrected or uncorrected degrees of freedom can be reported.

Usage

1
2
3
  nice.anova(object, es = NULL, correction = c("GG", "HF",
    "none"), sig.symbols = c(" +", " *", " **", " ***"),
    MSE = TRUE)

Arguments

object

An object of class "Anova.mlm" or "anova" as returned from Anova, ez.glm, or aov.car.

es

Effect Size to be reported. Currently none implemented.

correction

Character. Which sphericity correction on the degrees of freedom should be reported for the within-subject factors. The default c("GG", "HF", "none") corresponds to the Greenhouse-Geisser correction.

sig.symbols

Character. What should be the symbols designating significance? When entering an vector with length(sig.symbol) < 4 only those elements of the default (c(" +", " *", " **", " ***")) will be replaced. sig.symbols = "" will display the stars but not the +, sig.symbols = rep("", 4) will display no symbols.

MSE

logical. Should the column containing the Mean Sqaured Error (MSE) be displayed? Default is TRUE.

Details

The returned data.frame is print-ready when adding to a document with proper methods. I recommend ascii and xtable. ascii provides conversion to AsciiDoc but most notably to org-mode (see ascii and print-ascii). xtable converts a data.frame into LaTeX code with many possible options (e.g., allowing for "longtable" or "sidewaystable"), see xtable and print.xtable. See Examples.

Conversion functions to other formats (such as HTML, ODF, or Word) can be found at the Reproducible Research Task View.

Effect sizes are the next thing to implement!

Value

A data.frame with the ANOVA table consisting of characters. The columns that are always present are: Effect, df (degrees of freedom), F, and p.

See Also

ez.glm and aov.car are the convenience functions to create the object appropriate for nice.anova.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# exampel using obk.long (see ?obk.long), a long version of the OBrienKaiser dataset from car.

data(obk.long)

# run univariate mixed ANCOVA for the full design:
nice.anova(aov.car(value ~ treatment * gender + age + Error(id/phase*hour), data = obk.long))

nice.anova(ez.glm("id", "value", obk.long, c("treatment", "gender"), c("phase", "hour"), "age"))

# no between
nice.anova(ez.glm("id", "value", obk.long, NULL, c("phase", "hour")))

# no within
nice.anova(ez.glm("id", "value", obk.long, c("treatment", "gender")))

nice.anova(ez.glm("id", "value", obk.long, c("treatment", "gender")), sig.symbol = rep("", 4))

## Not run: 
# use package ascii or xtable for formatting of tables ready for printing.

full <- nice.anova(ez.glm("id", "value", obk.long, c("treatment", "gender"), c("phase", "hour"), "age"))

require(ascii)
print(ascii(full, include.rownames = FALSE, caption = "ANOVA 1"), type = "org")

require(xtable)
print.xtable(xtable(full, caption = "ANOVA 2"), include.rownames = FALSE)

## End(Not run)