Learn R Programming

afex (version 0.2-26)

nice.anova: 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

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
MSE
logical. Should the column containing the Mean Sqaured Error (MSE) be displayed? Default is TRUE.

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.

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 http://www.methods.co.nz/asciidoc/{AsciiDoc} but most notably to http://orgmode.org/{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 http://cran.r-project.org/web/views/ReproducibleResearch.html{Reproducible Research Task View}. Effect sizes are the next thing to implement!

See Also

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

Examples

Run this code
# 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))

# 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)

Run the code above in your browser using DataLab