nice {afex} | R Documentation |
This generic function produces a nice ANOVA table for printin for objects of class. nice_anova
takes an object from Anova
possible created by the convenience functions aov_ez
or aov_car
. When within-subject factors are present, either sphericity corrected or uncorrected degrees of freedom can be reported.
nice(object, ...) ## S3 method for class 'afex_aov' nice(object, es = NULL, observed = attr(object$anova_table, "observed"), correction = attr(object$anova_table, "correction"), MSE = NULL, intercept = NULL, p.adjust.method = attr(object$anova_table, "p.adjust.method"), sig.symbols = c(" +", " *", " **", " ***"), ...) ## S3 method for class 'anova' nice(object, MSE = TRUE, intercept = FALSE, sig.symbols = c(" +", " *", " **", " ***"), ...) ## S3 method for class 'mixed' nice(object, sig.symbols = c(" +", " *", " **", " ***"), ...) ## S3 method for class 'nice_table' print(x, ...)
object, x |
An object of class |
... |
currently ignored. |
es |
Effect Size to be reported. The default is given by |
observed |
character vector referring to the observed (i.e., non manipulated) variables/effects in the design. Important for calculation of generalized eta-squared (ignored if |
correction |
Character. Which sphericity correction of the degrees of freedom should be reported for the within-subject factors. The default is given by |
MSE |
logical. Should the column containing the Mean Sqaured Error (MSE) be displayed? Default is |
intercept |
logical. Should intercept (if present) be included in the ANOVA table? Default is |
p.adjust.method |
|
sig.symbols |
Character. What should be the symbols designating significance? When entering an vector with |
The returned data.frame
is print-ready when adding to a document with proper methods. Either directly via knitr or similar approaches such as via packages ascii or xtable (nowadays knitr is probably the best approach, see here). ascii provides conversion to AsciiDoc and 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.
The default reports generalized eta squared (Olejnik & Algina, 2003), the "recommended effect size for repeated measured designs" (Bakeman, 2005). Note that it is important that all measured variables (as opposed to experimentally manipulated variables), such as e.g., age, gender, weight, ..., must be declared via observed
to obtain the correct effect size estimate. Partial eta squared ("pes"
) does not require this.
Exploratory ANOVA, for which no detailed hypotheses have been specified a priori, harbor a multiple comparison problem (Cramer et al., 2015). To avoid an inflation of familywise Type I error rate, results need to be corrected for multiple comparisons using p.adjust.method
.
p.adjust.method
defaults to the method specified in the call to aov_car
in anova_table
. If no method was specified and p.adjust.method = NULL
p-values are not adjusted.
A data.frame
of class nice_table
with the ANOVA table consisting of characters. The columns that are always present are: Effect
, df
(degrees of freedom), F
, and p
.
ges
contains the generalized eta-squared effect size measure (Bakeman, 2005), pes
contains partial eta-squared (if requested).
The code for calculating generalized eta-squared was written by Mike Lawrence.
Everything else was written by Henrik Singmann.
Bakeman, R. (2005). Recommended effect size statistics for repeated measures designs. Behavior Research Methods, 37(3), 379-384. doi:10.3758/BF03192707
Cramer, A. O. J., van Ravenzwaaij, D., Matzke, D., Steingroever, H., Wetzels, R., Grasman, R. P. P. P., ... Wagenmakers, E.-J. (2015). Hidden multiplicity in exploratory multiway ANOVA: Prevalence and remedies. Psychonomic Bulletin & Review, 1–8. doi:10.3758/s13423-015-0913-5
Olejnik, S., & Algina, J. (2003). Generalized Eta and Omega Squared Statistics: Measures of Effect Size for Some Common Research Designs. Psychological Methods, 8(4), 434-447. doi:10.1037/1082-989X.8.4.434
aov_ez
and aov_car
are the convenience functions to create the object appropriate for nice_anova
.
## example from Olejnik & Algina (2003) # "Repeated Measures Design" (pp. 439): data(md_12.1) # create object of class afex_aov: rmd <- aov_ez("id", "rt", md_12.1, within = c("angle", "noise")) # use different es: nice(rmd, es = "pes") # noise: .82 nice(rmd, es = "ges") # noise: .39 # exampel using obk.long (see ?obk.long), a long version of the OBrienKaiser dataset from car. data(obk.long) # create object of class afex_aov: tmp.aov <- aov_car(value ~ treatment * gender + Error(id/phase*hour), data = obk.long) nice(tmp.aov, observed = "gender") nice(tmp.aov, observed = "gender", sig.symbol = rep("", 4)) ## Not run: # use package ascii or xtable for formatting of tables ready for printing. full <- nice(tmp.aov, observed = "gender") 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)