ezANOVA {ez} | R Documentation |
This function provides easy analysis of data from factorial experiments, including purely within-Ss designs (a.k.a. "repeated measures"), purely between-Ss designs, and mixed within-and-between-Ss designs, yielding ANOVA results and assumption checks.
ezANOVA( data , dv , sid , within = NULL , between = NULL , collapse_within = FALSE )
data |
Data frame containing the data to be analyzed. |
dv |
.() object specifying the column in data that contains the dependent variable. Values in this column must be numeric.
|
sid |
.() object specifying the column in data that contains the variable specifying the case/Ss identifier.
|
within |
Optional .() object specifying one or more columns in data that contain independent variables that are manipulated within-Ss.
|
between |
Optional .() object specifying one or more columns in data that contain independent variables that are manipulated between-Ss.
|
collapse_within |
Optional boolean to trigger the collapse of a single 2-level within-Ss varbiable to a difference score (useful when seeking to test homogeniety of variance of the difference scores). |
While within
and between
are both optional, at least one column of data
must be provided to either within
or between
. Any numeric or character variables in data
that are specified as either sid
, within
or between
will be converted to a factor with a warning. Prior to running, dv
is collapsed to a mean for each cell defined by the combination of sid
, within
or between
.
A list containing one or more of the following components:
ANOVA |
A data frame containing the ANOVA results. |
Mauchly's Test for Sphericity |
If any within-Ss variables with >2 levels are present, a data frame containing the results of Mauchly's test for Sphericity. Only reported for effects >2 levels because sphericity necessarily holds for effects with only 2 levels. |
Sphericity Corrections |
If any within-Ss variables are present, a data frame containing the Greenhouse-Geisser & Huynh-Feldt epsilon values, and corresponding corrected p-values. |
Levene's Test for Homgeneity |
If the design is purely between-Ss, a data frame containing the results of Levene's test for Homgeneity of variance. |
The statistical computing in ezAnova()
is driven by the Anova
function from the car
package, using the univariate Type-II test. If there are too few Ss in the data set for Anova
to compute its MANOVA, ezAnova()
will revert to using aov
for computing the ANOVA, in which case no assumption tests are provided. When assumption tests are provided via Anova
, Huynh-Feldt corrected p-values where the Huynh-Feldt epsilon >1 will use 1 as the correction epsilon.
Some column names in the output data frames are abbreviated to conserve space:
Michael A. Lawrence Mike.Lawrence@dal.ca
ezCor
, ezPerm
, ezPlot
, ezStats
#Read in the ANT data (see ?ANT). data(ANT) #Show summaries of the ANT data. head(ANT) str(ANT) summary(ANT) #Compute some useful statistics per cell. cell_stats = ddply( .data = ANT , .variables = .( sid , group , cue , flanker ) , .fun <- function(x){ #Compute error rate as percent. error_rate = (1-mean(x$acc))*100 #Compute mean RT (only accurate trials). mean_rt = mean(x$rt[x$acc==1]) #Compute SD RT (only accurate trials). sd_rt = sd(x$rt[x$acc==1]) return(c(error_rate=error_rate,mean_rt=mean_rt,sd_rt=sd_rt)) } ) #Run an ANOVA on the mean_rt data. mean_rt_anova = ezANOVA( data = cell_stats , dv = .(mean_rt) , sid = .(sid) , within = .(cue,flanker) , between = .(group) ) #Show the ANOVA & assumption tests. print(mean_rt_anova) #Run an ANOVA on the mean_rt data, ignoring group. mean_rt_anova2 = ezANOVA( data = cell_stats , dv = .(mean_rt) , sid = .(sid) , within = .(cue,flanker) ) #Show the ANOVA & assumption tests. print(mean_rt_anova2) #Run a purely between-Ss ANOVA on the mean_rt data. ##Note how ezANOVA automatically collapses the unspecified within-Ss data. mean_rt_anova3 = ezANOVA( data = cell_stats , dv = .(mean_rt) , sid = .(sid) , between = .(group) ) #Show the ANOVA & assumption tests. print(mean_rt_anova3)