Description Usage Arguments Details Value Author(s) References See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | nice(object, ...)
## S3 method for class 'afex_aov'
nice(object, es = afex_options("es_aov"),
observed = NULL, correction = afex_options("correction_aov"),
MSE = TRUE, intercept = FALSE, 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(" +", " *", " **", " ***"), ...)
|
object |
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 |
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. 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.
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.
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
.
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
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
.
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 30 | ## 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)
|
Loading required package: lme4
Loading required package: Matrix
Loading required package: lsmeans
Loading required package: estimability
************
Welcome to afex. For support visit: http://afex.singmann.science/
- Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
- Methods for calculating p-values with mixed(): 'KR', 'S', 'LRT', and 'PB'
- 'afex_aov' and 'mixed' objects can be passed to lsmeans() for follow-up tests
- Get and set global package options with: afex_options()
- Set orthogonal sum-to-zero contrasts globally: set_sum_contrasts()
- For example analyses see: browseVignettes("afex")
************
Attaching package: 'afex'
The following object is masked from 'package:lme4':
lmer
Anova Table (Type 3 tests)
Response: rt
Effect df MSE F pes p.value
1 angle 1.92, 17.31 3702.02 40.72 *** .82 <.0001
2 noise 1, 9 8460.00 33.77 *** .79 .0003
3 angle:noise 1.81, 16.27 1283.22 45.31 *** .83 <.0001
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
Sphericity correction method: GG
Anova Table (Type 3 tests)
Response: rt
Effect df MSE F ges p.value
1 angle 1.92, 17.31 3702.02 40.72 *** .39 <.0001
2 noise 1, 9 8460.00 33.77 *** .39 .0003
3 angle:noise 1.81, 16.27 1283.22 45.31 *** .19 <.0001
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
Sphericity correction method: GG
Contrasts set to contr.sum for the following variables: treatment, gender
Anova Table (Type 3 tests)
Response: value
Effect df MSE F ges p.value
1 treatment 2, 10 22.81 3.94 + .20 .05
2 gender 1, 10 22.81 3.66 + .11 .08
3 treatment:gender 2, 10 22.81 2.86 .18 .10
4 phase 1.60, 15.99 5.02 16.13 *** .15 .0003
5 treatment:phase 3.20, 15.99 5.02 4.85 * .10 .01
6 gender:phase 1.60, 15.99 5.02 0.28 .003 .71
7 treatment:gender:phase 3.20, 15.99 5.02 0.64 .01 .61
8 hour 1.84, 18.41 3.39 16.69 *** .13 <.0001
9 treatment:hour 3.68, 18.41 3.39 0.09 .002 .98
10 gender:hour 1.84, 18.41 3.39 0.45 .004 .63
11 treatment:gender:hour 3.68, 18.41 3.39 0.62 .01 .64
12 phase:hour 3.60, 35.96 2.67 1.18 .02 .33
13 treatment:phase:hour 7.19, 35.96 2.67 0.35 .009 .93
14 gender:phase:hour 3.60, 35.96 2.67 0.93 .01 .45
15 treatment:gender:phase:hour 7.19, 35.96 2.67 0.74 .02 .65
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
Sphericity correction method: GG
Anova Table (Type 3 tests)
Response: value
Effect df MSE F ges p.value
1 treatment 2, 10 22.81 3.94 + .20 .05
2 gender 1, 10 22.81 3.66 + .11 .08
3 treatment:gender 2, 10 22.81 2.86 .18 .10
4 phase 1.60, 15.99 5.02 16.13 *** .15 .0003
5 treatment:phase 3.20, 15.99 5.02 4.85 * .10 .01
6 gender:phase 1.60, 15.99 5.02 0.28 .003 .71
7 treatment:gender:phase 3.20, 15.99 5.02 0.64 .01 .61
8 hour 1.84, 18.41 3.39 16.69 *** .13 <.0001
9 treatment:hour 3.68, 18.41 3.39 0.09 .002 .98
10 gender:hour 1.84, 18.41 3.39 0.45 .004 .63
11 treatment:gender:hour 3.68, 18.41 3.39 0.62 .01 .64
12 phase:hour 3.60, 35.96 2.67 1.18 .02 .33
13 treatment:phase:hour 7.19, 35.96 2.67 0.35 .009 .93
14 gender:phase:hour 3.60, 35.96 2.67 0.93 .01 .45
15 treatment:gender:phase:hour 7.19, 35.96 2.67 0.74 .02 .65
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
Sphericity correction method: GG
Loading required package: ascii
Attaching package: 'ascii'
The following object is masked from 'package:Matrix':
expand
#+CAPTION: ANOVA 1
| Effect | df | MSE | F | ges | p.value |
|-----------------------------+-------------+-------+-----------+------+---------|
| treatment | 2, 10 | 22.81 | 3.94 + | .20 | .05 |
| gender | 1, 10 | 22.81 | 3.66 + | .11 | .08 |
| treatment:gender | 2, 10 | 22.81 | 2.86 | .18 | .10 |
| phase | 1.60, 15.99 | 5.02 | 16.13 *** | .15 | .0003 |
| treatment:phase | 3.20, 15.99 | 5.02 | 4.85 * | .10 | .01 |
| gender:phase | 1.60, 15.99 | 5.02 | 0.28 | .003 | .71 |
| treatment:gender:phase | 3.20, 15.99 | 5.02 | 0.64 | .01 | .61 |
| hour | 1.84, 18.41 | 3.39 | 16.69 *** | .13 | <.0001 |
| treatment:hour | 3.68, 18.41 | 3.39 | 0.09 | .002 | .98 |
| gender:hour | 1.84, 18.41 | 3.39 | 0.45 | .004 | .63 |
| treatment:gender:hour | 3.68, 18.41 | 3.39 | 0.62 | .01 | .64 |
| phase:hour | 3.60, 35.96 | 2.67 | 1.18 | .02 | .33 |
| treatment:phase:hour | 7.19, 35.96 | 2.67 | 0.35 | .009 | .93 |
| gender:phase:hour | 3.60, 35.96 | 2.67 | 0.93 | .01 | .45 |
| treatment:gender:phase:hour | 7.19, 35.96 | 2.67 | 0.74 | .02 | .65 |
Warning messages:
1: In rep(rownames, length = nrow(x)) :
'x' is NULL so the result will be NULL
2: In rep(colnames, length = ncol(x)) :
'x' is NULL so the result will be NULL
Loading required package: xtable
% latex table generated in R 3.4.1 by xtable 1.8-2 package
% Tue Apr 3 15:31:50 2018
\begin{table}[ht]
\centering
\begin{tabular}{llllll}
\hline
Effect & df & MSE & F & ges & p.value \\
\hline
treatment & 2, 10 & 22.81 & 3.94 + & .20 & .05 \\
gender & 1, 10 & 22.81 & 3.66 + & .11 & .08 \\
treatment:gender & 2, 10 & 22.81 & 2.86 & .18 & .10 \\
phase & 1.60, 15.99 & 5.02 & 16.13 *** & .15 & .0003 \\
treatment:phase & 3.20, 15.99 & 5.02 & 4.85 * & .10 & .01 \\
gender:phase & 1.60, 15.99 & 5.02 & 0.28 & .003 & .71 \\
treatment:gender:phase & 3.20, 15.99 & 5.02 & 0.64 & .01 & .61 \\
hour & 1.84, 18.41 & 3.39 & 16.69 *** & .13 & $<$.0001 \\
treatment:hour & 3.68, 18.41 & 3.39 & 0.09 & .002 & .98 \\
gender:hour & 1.84, 18.41 & 3.39 & 0.45 & .004 & .63 \\
treatment:gender:hour & 3.68, 18.41 & 3.39 & 0.62 & .01 & .64 \\
phase:hour & 3.60, 35.96 & 2.67 & 1.18 & .02 & .33 \\
treatment:phase:hour & 7.19, 35.96 & 2.67 & 0.35 & .009 & .93 \\
gender:phase:hour & 3.60, 35.96 & 2.67 & 0.93 & .01 & .45 \\
treatment:gender:phase:hour & 7.19, 35.96 & 2.67 & 0.74 & .02 & .65 \\
\hline
\end{tabular}
\caption{ANOVA 2}
\end{table}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.