% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aov_car.R
\encoding{UTF-8}
\name{aov_car}
\alias{aov_car}
\alias{aov_4}
\alias{aov_ez}
\title{Convenient ANOVA estimation for factorial designs}
\usage{
aov_car(
  formula,
  data,
  fun_aggregate = NULL,
  type = afex_options("type"),
  factorize = afex_options("factorize"),
  observed = NULL,
  anova_table = list(),
  include_aov = afex_options("include_aov"),
  return = afex_options("return_aov"),
  ...
)

aov_4(
  formula,
  data,
  observed = NULL,
  fun_aggregate = NULL,
  type = afex_options("type"),
  factorize = afex_options("factorize"),
  return = afex_options("return_aov"),
  anova_table = list(),
  include_aov = afex_options("include_aov"),
  ...,
  print.formula = FALSE
)

aov_ez(
  id,
  dv,
  data,
  between = NULL,
  within = NULL,
  covariate = NULL,
  observed = NULL,
  fun_aggregate = NULL,
  transformation,
  type = afex_options("type"),
  factorize = afex_options("factorize"),
  return = afex_options("return_aov"),
  anova_table = list(),
  include_aov = afex_options("include_aov"),
  ...,
  print.formula = FALSE
)
}
\arguments{
\item{formula}{A formula specifying the ANOVA model similar to
\code{\link{aov}} (for \code{aov_car} or similar to \code{lme4:lmer} for
\code{aov_4}). Must include an error term (i.e., \code{Error(id/...)} for
\code{aov_car} or \code{(...|id)} for \code{aov_4}). Note that the
within-subject factors do not need to be outside the Error term (this
contrasts with \code{aov}). See Details.}

\item{data}{A \code{data.frame} containing the data. Mandatory.}

\item{fun_aggregate}{The function for aggregating the data before running the
ANOVA if there is more than one observation per individual and cell of the
design. The default \code{NULL} issues a warning if aggregation is
necessary and uses \code{\link{mean}}. Pass \code{mean} directly to avoid
the warning.}

\item{type}{The type of sums of squares for the ANOVA. The default is given
by \code{afex_options("type")}, which is \strong{initially set to 3}.
Passed to \code{\link[car]{Anova}}. Possible values are \code{"II"},
\code{"III"}, \code{2}, or \code{3}.}

\item{factorize}{logical. Should between subject factors be factorized (with
note) before running the analysis. The default is given by
\code{afex_options("factorize")}, which is initially \code{TRUE}. If one
wants to run an ANCOVA, this needs to be set to \code{FALSE} (in which case
centering on 0 is checked on numeric variables).}

\item{observed}{\code{character} vector indicating which of the variables are
observed (i.e, measured) as compared to experimentally manipulated. The
default effect size reported (generalized eta-squared) requires correct
specification of the obsered (in contrast to manipulated) variables.}

\item{anova_table}{\code{list} of further arguments passed to function
producing the ANOVA table.  Arguments such as \code{es} (effect size) or
\code{correction}  are passed to either \code{anova.afex_aov} or
\code{nice}. Note that those settings can also be changed once an object of
class \code{afex_aov} is created by invoking the \code{anova} method
directly.}

\item{include_aov}{Boolean. Allows suppressing the calculation of the aov
object. If TRUE the aov model is part of the returned \code{afex_aov}
object. \code{FALSE} (the default) prevents this potentially costly
calculation. Especially for designs with larger N and within-subjects
factors, this is highly advisable. Follow-up analyses using \pkg{emmeans}
using the \code{univariate} model (which is not recommended) require the
aov model and TRUE.}

\item{return}{What should be returned? The default is given by
\code{afex_options("return_aov")}, which is initially \code{"afex_aov"},
returning an S3 object of class \code{afex_aov} for which various
\link[=afex_aov-methods]{methods} exist (see there and below for more
details). Other values are currently still supported for backward
compatibility.}

\item{...}{Further arguments passed to \code{fun_aggregate}.}

\item{print.formula}{\code{aov_ez} and \code{aov_4} are wrapper for
\code{aov_car}. This boolean argument indicates whether the formula in the
call to \code{car.aov} should be printed.}

\item{id}{\code{character} vector (of length 1) indicating the subject
identifier column in \code{data}.}

\item{dv}{\code{character} vector (of length 1) indicating the column
containing the \strong{dependent variable} in \code{data}.}

\item{between}{\code{character} vector indicating the
\strong{between}-subject(s) factor(s)/column(s) in \code{data}. Default is
\code{NULL} indicating no between-subjects factors.}

\item{within}{\code{character} vector indicating the
\strong{within}-subject(s)(or repeated-measures) factor(s)/column(s) in
\code{data}.  Default is \code{NULL} indicating no within-subjects factors.}

\item{covariate}{\code{character} vector indicating the between-subject(s)
covariate(s) (i.e., column(s)) in \code{data}. Default is \code{NULL}
indicating no covariates. Please note that \code{factorize} needs to be set
to \code{FALSE} in case the covariate is numeric and should be treated as
such.}

\item{transformation}{In \code{aov_ez}, a \code{character} vector (of length 
1) indicating the name of a transformation to apply to \code{dv} before 
fitting the model. If missing, no transformation is applied. In 
\code{aov_car} and \code{aov_4}, a response transformation may be 
incorporated in the left-hand side of \code{formula}.}
}
\value{
\code{aov_car}, \code{aov_4}, and \code{aov_ez} are wrappers for
  \code{\link[car]{Anova}} and \code{\link{aov}}, the return value is
  dependent on the \code{return} argument. Per default, an S3 object of class
  \code{"afex_aov"} is returned containing the following slots:

\describe{
  \item{\code{"anova_table"}}{An ANOVA table of class \code{c("anova",
   "data.frame")}.}
  \item{\code{"aov"}}{\code{aov} object returned from \code{\link{aov}} 
   (should not be used to evaluate significance of effects, but can be passed
   to \code{emmeans} for post-hoc tests).}
  \item{\code{"Anova"}}{object returned from \code{\link[car]{Anova}}, an 
  object of class \code{"Anova.mlm"} (if within-subjects factors are present)
  or of class \code{c("anova", "data.frame")}.}
  \item{\code{"lm"}}{the object fitted with \code{lm} and passed to
   \code{Anova} (i.e., an object of class \code{"lm"} or \code{"mlm"}). Also
   returned if \code{return = "lm"}.}
  \item{\code{"data"}}{a list containing: (1) \code{long} (the possibly
   aggregated data in long format used for \code{aov}), \code{wide} (the data
   used to fit the \code{lm} object), and \code{idata} (if within-subject
   factors are present, the \code{idata} argument passed to
  \code{car::Anova}). Also returned if \code{return = "data"}.}
}
In addition, the object has the following attributes: \code{"dv"},
\code{"id"}, \code{"within"}, \code{"between"}, and \code{"type"}.

The \link[=afex_aov-methods]{print} method for \code{afex_aov} objects
(invisibly) returns (and prints) the same as if \code{return} is
\code{"nice"}: a nice ANOVA table (produced by \code{\link{nice}}) with the
following columns: \code{Effect}, \code{df}, \code{MSE} (mean-squared
errors), \code{F} (potentially with significant symbols), \code{ges}
(generalized eta-squared), \code{p}.
}
\description{
These functions allow convenient specification of any type of ANOVAs (i.e.,
purely within-subjects ANOVAs, purely between-subjects ANOVAs, and mixed
between-within or split-plot ANOVAs) for data in the \strong{long} format
(i.e., one observation per row). If the data has more than one observation
per individual and cell of the design (e.g., multiple responses per
condition), the data will be automatically aggregated. The default settings
reproduce results from commercial statistical packages such as SPSS or SAS.
\code{aov_ez} is called specifying the factors as character vectors,
\code{aov_car} is called using a formula similar to \code{\link{aov}}
specifying an error strata for the within-subject factor(s), and \code{aov_4}
is called with a \pkg{lme4}-like formula (all ANOVA functions return
identical results). The returned object contains the ANOVA also fitted via
base R's \code{\link{aov}} which can be passed to e.g., \pkg{emmeans} for
further analysis (e.g., follow-up tests, contrasts, plotting, etc.). These
functions employ \code{\link[car]{Anova}} (from the \pkg{car} package) to
provide test of effects avoiding the somewhat unhandy format of
\code{car::Anova}.
}
\details{
\subsection{Details of ANOVA Specification}{ \code{aov_ez} will concatenate
all between-subject factors using \code{*} (i.e., producing all main effects
and interactions) and all covariates by \code{+} (i.e., adding only the main
effects to the existing between-subject factors). The within-subject factors
do fully interact with all between-subject factors and covariates. This is
essentially identical to the behavior of SPSS's \code{glm} function.

The \code{formula}s for \code{aov_car} or \code{aov_4} must contain a single
\code{Error} term specifying the \code{ID} column and potential
within-subject factors (you can use \code{\link{mixed}} for running
mixed-effects models with multiple error terms). Factors outside the
\code{Error} term are treated as between-subject factors (the within-subject
factors specified in the \code{Error} term are ignored outside the
\code{Error} term; in other words, it is not necessary to specify them
outside the \code{Error} term, see Examples).\cr Suppressing the intercept
(i.e, via \code{0 +} or \code{- 1}) is ignored. Specific specifications of
effects (e.g., excluding terms with \code{-} or using \code{^}) could be okay
but is not tested. Using the \code{\link{I}} or \code{\link{poly}} function
within the formula is not tested and not supported!

To run an ANCOVA you need to set \code{factorize = FALSE} and make sure that
all variables have the correct type (i.e., factors are factors and numeric
variables are numeric and centered).

Note that the default behavior is to include calculation of the effect size
generalized eta-squared for which \strong{all non-manipluated (i.e.,
observed)} variables need to be specified via the \code{observed} argument to
obtain correct results. When changing the effect size to \code{"pes"}
(partial eta-squared) or \code{"none"} via \code{anova_table} this becomes
unnecessary.

Factor contrasts will be set to \code{"contr.sum"} for all between-subject
factors if default contrasts are not equal to \code{"contr.sum"} or
\code{attrib(factor, "contrasts") != "contr.sum"}. (within-subject factors
are hard-coded \code{"contr.sum"}.) }

\subsection{Statistical Issues}{ \strong{Type 3 sums of squares are default
in \pkg{afex}.} While some authors argue that so-called type 3 sums of
squares are dangerous and/or problematic (most notably Venables, 2000), they
are the default in many commercial statistical application such as SPSS or
SAS. Furthermore, statisticians with an applied perspective recommend type 3
tests (e.g., Maxwell and Delaney, 2004). Consequently, they are the default
for the ANOVA functions described here. For some more discussion on this
issue see \href{https://stats.stackexchange.com/q/6208/442}{here}.

Note that lower order effects (e.g., main effects) in type 3 ANOVAs are only
meaningful with
\href{https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faqwhat-is-effect-coding/}{effects
coding}. Therefore, contrasts are set to \code{\link{contr.sum}} which
ensures meaningful results. For a discussion of the other (non-recommended)
coding schemes see
\href{https://stats.oarc.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/}{here}.
}

\subsection{Follow-Up Contrasts and Post-Hoc Tests}{ The S3 object returned
per default can be directly passed to \code{emmeans::emmeans} for further
analysis. This allows to test any type of contrasts that might be of interest
independent of whether or not this contrast involves between-subject
variables, within-subject variables, or a combination thereof. The general
procedure to run those contrasts is the following (see Examples for a full
example):

 \enumerate{
   \item Estimate an \code{afex_aov} object with the function returned here. For example: \code{x <- aov_car(dv ~ a*b + (id/c), d)}
   \item Obtain a \code{\link[emmeans]{emmGrid-class}} object by running \code{\link[emmeans]{emmeans}} on the \code{afex_aov} object from step 1 using the factors involved in the contrast. For example: \code{r <- emmeans(x, ~a:c)}
   \item Create a list containing the desired contrasts on the reference grid object from step 2. For example: \code{con1 <- list(a_x = c(-1, 1, 0, 0, 0, 0), b_x = c(0, 0, -0.5, -0.5, 0, 1))}
   \item Test the contrast on the reference grid using \code{\link[emmeans]{contrast}}. For example: \code{contrast(r, con1)}
   \item To control for multiple testing p-value adjustments can be specified. For example the Bonferroni-Holm correction: \code{contrast(r, con1, adjust = "holm")}
 }
 
 Note that \pkg{emmeans} allows for a variety of advanced settings and
 simplifications, for example: all pairwise comparison of a single factor
 using one command (e.g., \code{emmeans(x, "a", contr = "pairwise")}) or
 advanced control for multiple testing by passing objects to \pkg{multcomp}.
 A comprehensive overview of the functionality is provided in the
 accompanying vignettes (see
 \href{https://CRAN.R-project.org/package=emmeans}{here}).
 
 Since version 1.0, \pkg{afex} per default uses the \code{multivariate} model
 (i.e., the \code{lm} slot of the \code{afex_aov} object) for follow-up tests
 with \pkg{emmeans}. Compared to the \code{univariate} model (i.e., the
 \code{aov} slot), this can handle unbalanced data and addresses sphericity
 better. To use the older (and not recommended) \code{model = "univariate"}
 make sure to set \code{include_aov = TRUE} when estimating the ANOVA.
 
 Starting with \pkg{afex} version 0.22, \pkg{emmeans} is \emph{not}
 loaded/attached automatically when loading \pkg{afex}. Therefore,
 \pkg{emmeans} now needs to be loaded by the user via
 \code{library("emmeans")} or \code{require("emmeans")}.
}  

\subsection{Methods for \code{afex_aov} Objects}{ A full overview over the
methods provided for \code{afex_aov} objects is provided in the corresponding
help page: \code{\link{afex_aov-methods}}. The probably most important ones
for end-users are \code{summary}, \code{anova}, and \code{\link{nice}}.

The \code{summary} method returns, for ANOVAs containing within-subject
(repeated-measures) factors with more than two levels, the complete
univariate analysis: Results without df-correction, the Greenhouse-Geisser
corrected results, the Hyunh-Feldt corrected results, and the results of the
Mauchly test for sphericity.

The \code{anova} method returns a \code{data.frame} of class \code{"anova"}
containing the ANOVA table in numeric form (i.e., the one in slot
\code{anova_table} of a \code{afex_aov}). This method has arguments such as
\code{correction} and \code{es} and can be used to obtain an ANOVA table with
different correction than the one initially specified.

The \code{\link{nice}} method also returns a \code{data.frame}, but rounds
most values and transforms them into characters for nice printing. Also has
arguments like \code{correction} and \code{es} which can be used to obtain an
ANOVA table with different correction than the one initially specified. }
}
\section{Functions}{
\itemize{
\item \code{aov_4()}: Allows definition of ANOVA-model using
\code{lme4::lmer}-like Syntax (but still fits a standard ANOVA).

\item \code{aov_ez()}: Allows definition of ANOVA-model using character strings.

}}
\note{
Calculation of ANOVA models via \code{aov} (which is done per default)
  can be comparatively slow and produce comparatively large objects for
  ANOVAs with many within-subjects factors or levels. To avoid this
  calculation set \code{include_aov = FALSE}. You can also disable this
  globally with: \code{afex_options(include_aov = FALSE)}
  
  The id variable and variables entered as within-subjects (i.e.,
  repeated-measures) factors are silently converted to factors. Levels of
  within-subject factors are converted to valid variable names using
  \code{\link{make.names}(...,unique=TRUE)}. Unused factor levels are
  silently dropped on all variables.
  
  Contrasts attached to a factor as an attribute are probably not preserved
  and not supported.
  
  The workhorse is \code{aov_car}. \code{aov_4} and \code{aov_ez} only
  construe and pass an appropriate formula to \code{aov_car}. Use
  \code{print.formula = TRUE} to view this formula.
  
  In contrast to \code{\link{aov}} \code{aov_car} assumes that all factors to
  the right of \code{/} in the \code{Error} term are belonging together.
  Consequently, \code{Error(id/(a*b))} and \code{Error(id/a*b)} are identical
  (which is not true for \code{\link{aov}}).
}
\examples{

##########################
## 1: Specifying ANOVAs ##
##########################

# Example using a purely within-subjects design 
# (Maxwell & Delaney, 2004, Chapter 12, Table 12.5, p. 578):
data(md_12.1)
aov_ez("id", "rt", md_12.1, within = c("angle", "noise"), 
       anova_table=list(correction = "none", es = "none"))

# Default output
aov_ez("id", "rt", md_12.1, within = c("angle", "noise"))       


# examples using obk.long (see ?obk.long), a long version of the OBrienKaiser
# dataset (car package). Data is a split-plot or mixed design: contains both
# within- and between-subjects factors.
data(obk.long, package = "afex")

# estimate mixed ANOVA on the full design:
aov_car(value ~ treatment * gender + Error(id/(phase*hour)), 
        data = obk.long, observed = "gender")

aov_4(value ~ treatment * gender + (phase*hour|id), 
        data = obk.long, observed = "gender")

aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
        within = c("phase", "hour"), observed = "gender")

# the three calls return the same ANOVA table:
# Anova Table (Type 3 tests)
# 
# Response: value
#                         Effect          df   MSE         F  ges p.value
# 1                    treatment       2, 10 22.81    3.94 + .198    .055
# 2                       gender       1, 10 22.81    3.66 + .115    .085
# 3             treatment:gender       2, 10 22.81      2.86 .179    .104
# 4                        phase 1.60, 15.99  5.02 16.13 *** .151   <.001
# 5              treatment:phase 3.20, 15.99  5.02    4.85 * .097    .013
# 6                 gender:phase 1.60, 15.99  5.02      0.28 .003    .709
# 7       treatment:gender:phase 3.20, 15.99  5.02      0.64 .014    .612
# 8                         hour 1.84, 18.41  3.39 16.69 *** .125   <.001
# 9               treatment:hour 3.68, 18.41  3.39      0.09 .002    .979
# 10                 gender:hour 1.84, 18.41  3.39      0.45 .004    .628
# 11       treatment:gender:hour 3.68, 18.41  3.39      0.62 .011    .641
# 12                  phase:hour 3.60, 35.96  2.67      1.18 .015    .335
# 13        treatment:phase:hour 7.19, 35.96  2.67      0.35 .009    .930
# 14           gender:phase:hour 3.60, 35.96  2.67      0.93 .012    .449
# 15 treatment:gender:phase:hour 7.19, 35.96  2.67      0.74 .019    .646
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘+’ 0.1 ‘ ’ 1
# 
# Sphericity correction method: GG 

# "numeric" variables are per default converted to factors (as long as factorize
# = TRUE):
obk.long$hour2 <- as.numeric(as.character(obk.long$hour))

# gives same results as calls before
aov_car(value ~ treatment * gender + Error(id/phase*hour2), 
        data = obk.long, observed = c("gender"))


# ANCOVA: adding a covariate (necessary to set factorize = FALSE)
aov_car(value ~ treatment * gender + age + Error(id/(phase*hour)), 
        data = obk.long, observed = c("gender", "age"), factorize = FALSE)

aov_4(value ~ treatment * gender + age + (phase*hour|id), 
        data = obk.long, observed = c("gender", "age"), factorize = FALSE)

aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
        within = c("phase", "hour"), covariate = "age", 
        observed = c("gender", "age"), factorize = FALSE)


# aggregating over one within-subjects factor (phase), with warning:
aov_car(value ~ treatment * gender + Error(id/hour), data = obk.long, 
        observed = "gender")

aov_ez("id", "value", obk.long, c("treatment", "gender"), "hour", 
       observed = "gender")

# aggregating over both within-subjects factors (again with warning),
# only between-subjects factors:
aov_car(value ~ treatment * gender + Error(id), data = obk.long, 
        observed = c("gender"))
aov_4(value ~ treatment * gender + (1|id), data = obk.long, 
      observed = c("gender"))
aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
       observed = "gender")

# only within-subject factors (ignoring between-subjects factors)
aov_car(value ~ Error(id/(phase*hour)), data = obk.long)
aov_4(value ~ (phase*hour|id), data = obk.long)
aov_ez("id", "value", obk.long, within = c("phase", "hour"))

### changing defaults of ANOVA table:

# no df-correction & partial eta-squared:
aov_car(value ~ treatment * gender + Error(id/(phase*hour)), 
        data = obk.long, anova_table = list(correction = "none", es = "pes"))

# no df-correction and no MSE
aov_car(value ~ treatment * gender + Error(id/(phase*hour)), 
        data = obk.long,observed = "gender", 
        anova_table = list(correction = "none", MSE = FALSE))

# add p-value adjustment for all effects (see Cramer et al., 2015, PB&R)
aov_ez("id", "value", obk.long, between = "treatment", 
       within = c("phase", "hour"), 
       anova_table = list(p_adjust_method = "holm"))


###########################
## 2: Follow-up Analysis ##
###########################

# use data as above
data(obk.long, package = "afex")

# 1. obtain afex_aov object:
a1 <- aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
        within = c("phase", "hour"), observed = "gender")


if (requireNamespace("ggplot2") & requireNamespace("emmeans")) {
# 1b. plot data using afex_plot function, for more see: 
## vignette("afex_plot_introduction", package = "afex")

## default plot uses multivariate model-based CIs
afex_plot(a1, "hour", "gender", c("treatment", "phase"))

  
a1b <- aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
        within = c("phase", "hour"), observed = "gender", 
        include_aov = TRUE)
## you can use a univariate model and CIs if you refit the model with the aov
## slot
afex_plot(a1b, "hour", "gender", c("treatment", "phase"), 
          emmeans_arg = list(model = "univariate"))

## in a mixed between-within designs, no error-bars might be preferrable:
afex_plot(a1, "hour", "gender", c("treatment", "phase"), error = "none")
}

if (requireNamespace("emmeans")) {
library("emmeans")  # package emmeans needs to be attached for follow-up tests.

# 2. obtain reference grid object (default uses multivariate model):
r1 <- emmeans(a1, ~treatment +phase)
r1

# 3. create list of contrasts on the reference grid:
c1 <- list(
  A_B_pre = c(rep(0, 6), 0, -1, 1),  # A versus B for pretest
  A_B_comb = c(-0.5, 0.5, 0, -0.5, 0.5, 0, 0, 0, 0), # A vs. B for post and follow-up combined
  effect_post = c(0, 0, 0, -1, 0.5, 0.5, 0, 0, 0), # control versus A&B post
  effect_fup = c(-1, 0.5, 0.5, 0, 0, 0, 0, 0, 0), # control versus A&B follow-up
  effect_comb = c(-0.5, 0.25, 0.25, -0.5, 0.25, 0.25, 0, 0, 0) # control versus A&B combined
)

# 4. test contrasts on reference grid:
contrast(r1, c1)

# same as before, but using Bonferroni-Holm correction for multiple testing:
contrast(r1, c1, adjust = "holm")

# 2. (alternative): all pairwise comparisons of treatment:
emmeans(a1, "treatment", contr = "pairwise")
}

#######################
## 3: Other examples ##
#######################
data(obk.long, package = "afex")

# replicating ?Anova using aov_car:
obk_anova <- aov_car(value ~ treatment * gender + Error(id/(phase*hour)), 
        data = obk.long, type = 2)
# in contrast to aov you do not need the within-subject factors outside Error()

str(obk_anova, 1, give.attr = FALSE)
# List of 5
#  $ anova_table:Classes ‘anova’ and 'data.frame':	15 obs. of  6 variables:
#  $ aov        : NULL
#  $ Anova      :List of 14
#  $ lm         :List of 13
#  $ data       :List of 3

obk_anova$Anova
# Type II Repeated Measures MANOVA Tests: Pillai test statistic
#                             Df test stat approx F num Df den Df    Pr(>F)    
# (Intercept)                  1   0.96954   318.34      1     10 6.532e-09 ***
# treatment                    2   0.48092     4.63      2     10 0.0376868 *  
# gender                       1   0.20356     2.56      1     10 0.1409735    
# treatment:gender             2   0.36350     2.86      2     10 0.1044692    
# phase                        1   0.85052    25.61      2      9 0.0001930 ***
# treatment:phase              2   0.68518     2.61      4     20 0.0667354 .  
# gender:phase                 1   0.04314     0.20      2      9 0.8199968    
# treatment:gender:phase       2   0.31060     0.92      4     20 0.4721498    
# hour                         1   0.93468    25.04      4      7 0.0003043 ***
# treatment:hour               2   0.30144     0.35      8     16 0.9295212    
# gender:hour                  1   0.29274     0.72      4      7 0.6023742    
# treatment:gender:hour        2   0.57022     0.80      8     16 0.6131884    
# phase:hour                   1   0.54958     0.46      8      3 0.8324517    
# treatment:phase:hour         2   0.66367     0.25     16      8 0.9914415    
# gender:phase:hour            1   0.69505     0.85      8      3 0.6202076    
# treatment:gender:phase:hour  2   0.79277     0.33     16      8 0.9723693    
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

}
\references{
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.
  \emph{Psychonomic Bulletin & Review}, 1-8. \doi{10.3758/s13423-015-0913-5}
  
  Maxwell, S. E., & Delaney, H. D. (2004). \emph{Designing Experiments and
  Analyzing Data: A Model-Comparisons Perspective}. Mahwah, N.J.: Lawrence
  Erlbaum Associates.
  
  Venables, W.N. (2000). \emph{Exegeses on linear models}. Paper presented to
  the S-Plus User's Conference, Washington DC, 8-9 October 1998, Washington,
  DC. Available from: \url{http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf}
}
\seealso{
Various methods for objects of class \code{afex_aov} are available:
  \code{\link{afex_aov-methods}}
  
\code{\link{nice}} creates the nice ANOVA tables which is by default printed.
See also there for a slightly longer discussion of the available effect
sizes.

\code{\link{mixed}} provides a (formula) interface for obtaining p-values for
mixed-models via \pkg{lme4}. The functions presented here do not estimate
mixed models.
}
\author{
Henrik Singmann

The design of these functions was influenced by \code{\link[ez]{ezANOVA}}
from package \pkg{ez}.
}
