Description Usage Arguments Details Value Warning Author(s) References See Also Examples
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, generalized effect sizes and assumption checks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
data |
Data frame containing the data to be analyzed. |
dv |
Name of the column in |
wid |
Name of the column in |
within |
Names of columns in |
within_full |
Same as within, but intended to specify the full within-Ss design in cases where the data have not already been collapsed to means per condition specified by |
within_covariates |
Names of columns in |
between |
Names of columns in |
between_covariates |
Names of columns in |
observed |
Names of columns in |
diff |
Names of any variables to collapse to a difference score. If a single value, may be specified by name alone; if multiple values, must be specified as a .() list. All supplied variables must be factors, ideally with only two levels (especially if setting the |
reverse_diff |
Logical. If TRUE, triggers reversal of the difference collapse requested by |
type |
Numeric value (either |
white.adjust |
Only affects behaviour if the design contains only between-Ss predictor variables. If not FALSE, the value is passed as the white.adjust argument to |
detailed |
Logical. If TRUE, returns extra information (sums of squares columns, intercept row, etc.) in the ANOVA table. |
return_aov |
Logical. If TRUE, computes and returns an aov object corresponding to the requested ANOVA (useful for computing post-hoc contrasts). |
ANCOVA is implemented by first regressing the DV against each covariate (after collapsing the data to the means of that covariate's levels per subject) and subtracting from the raw data the fitted values from this regression (then adding back the mean to maintain scale). These regressions are computed across Ss in the case of between-Ss covariates and computed within each Ss in the case of within-Ss covariates.
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 and Huynh-Feldt epsilon values, and corresponding corrected p-values. |
Levene's Test for Homogeneity |
If the design is purely between-Ss, a data frame containing the results of Levene's test for Homogeneity of variance. Note that Huynh-Feldt corrected p-values where the Huynh-Feldt epsilon >1 will use 1 as the correction epsilon. |
aov |
An aov object corresponding to the requested ANOVA. |
Some column names in the output data frames are abbreviated to conserve space:
DFn | Degrees of Freedom in the numerator (a.k.a. DFeffect). |
DFd | Degrees of Freedom in the denominator (a.k.a. DFerror). |
SSn | Sum of Squares in the numerator (a.k.a. SSeffect). |
SSd | Sum of Squares in the denominator (a.k.a. SSerror). |
F | F-value. |
p | p-value (probability of the data given the null hypothesis). |
p<.05 | Highlights p-values less than the traditional alpha level of .05. |
ges | Generalized Eta-Squared measure of effect size (see in references below: Bakeman, 2005). |
GGe | Greenhouse-Geisser epsilon. |
p[GGe] | p-value after correction using Greenhouse-Geisser epsilon. |
p[GGe]<.05 | Highlights p-values (after correction using Greenhouse-Geisser epsilon) less than the traditional alpha level of .05. |
HFe | Huynh-Feldt epsilon. |
p[HFe] | p-value after correction using Huynh-Feldt epsilon. |
p[HFe]<.05 | Highlights p-values (after correction using Huynh-Feldt epsilon) less than the traditional alpha level of .05. |
W | Mauchly's W statistic |
Prior to running (though after obtaining running ANCOVA regressions as described in the details
section), dv
is collapsed to a mean for each cell defined by the combination of wid
and any variables supplied to within
and/or between
and/or diff
. Users are warned that while convenient when used properly, this automatic collapsing can lead to inconsistencies if the pre-collapsed data are unbalanced (with respect to cells in the full design) and only the partial design is supplied to ezANOVA
. When this is the case, use within_full
to specify the full design to ensure proper automatic collapsing.
Michael A. Lawrence mike.lwrnc@gmail.com
Visit the ez
development site at http://github.com/mike-lawrence/ez
for the bug/issue tracker and the link to the mailing list.
Bakeman, R. (2005). Recommended effect size statistics for repeated measures designs. Behavior Research Methods, 37 (3), 379-384.
ezBoot
, ezMixed
, ezPerm
, ezPlot
, ezStats
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #Read in the ANT data (see ?ANT).
data(ANT)
head(ANT)
ezPrecis(ANT)
#Run an ANOVA on the mean correct RT data.
rt_anova = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt
, wid = subnum
, within = .(cue,flank)
, between = group
)
#Show the ANOVA and assumption tests.
print(rt_anova)
## Not run:
#Run an ANOVA on the mean correct RT data, ignoring group.
rt_anova2 = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt
, wid = subnum
, within = .(cue,flank)
)
#Show the ANOVA and assumption tests.
print(rt_anova2)
## End(Not run)
#Run a purely between-Ss ANOVA on the mean_rt data.
#NOTE use of within_full to ensure that the data are
# collapsed properly
rt_anova3 = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt
, wid = subnum
, within_full = .(cue,flank)
, between = group
)
#Show the ANOVA and assumption tests.
print(rt_anova3)
#add a within-Ss effect to be used as a covariate
ANT$rt2 = ANT$rt + ANT$block*1000 #additive with and independent of the other predictors!
## Not run:
#Run an anova that doesn't use the covariate
rt_anova4a = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt2
, wid = subnum
, within = .(cue,flank)
, between = group
)
#Show the ANOVA and assumption tests.
# Note loss of power to observe the within effects
print(rt_anova4a)
## End(Not run)
#Run an anova that does use the covariate
rt_anova4b = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt2
, wid = subnum
, within = .(cue,flank)
, within_covariates = block
, between = group
)
#Show the ANOVA and assumption tests.
# Note power to observe the within effects has returned
print(rt_anova4b)
#add a between-Ss effect to be used as a covariate
ANT$bc = as.numeric(as.character(ANT$subnum))%%10 #Note that the effect is balanced across groups
ANT$rt3 = ANT$rt + ANT$bc*1000 #additive with and independent of the other predictors!
## Not run:
#Run an anova that doesn't use the covariate
rt_anova5a = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt2
, wid = subnum
, within = .(cue,flank)
, between = group
)
#Show the ANOVA and assumption tests.
# Note loss of power to observe the between effects
print(rt_anova5a)
## End(Not run)
#Run an anova that does use the covariate
rt_anova5b = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt2
, wid = subnum
, within = .(cue,flank)
, between = group
, between_covariates = bc
)
#Show the ANOVA and assumption tests.
# Note power to observe the between effects has returned
print(rt_anova5b)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.