Home forums ANOVA MANOVA?

• Author
Posts
• #211
MattMcMullen
Participant

Greetings, is it possible to conduct a MANOVA with afex? Thanks.

• #212
henrik
Keymaster

In principle yes, but potentially not in the way you want it.

Let me explain: To calculate the ANOVA `afex` uses `car::Anova` which per default calculates both univariate (i.e., repeated-measures ANOVA) and multivariate tests for the repeated-measures factors. Per default, only the univariate tests are reported. But the multivariate tests can be obtained easily via `summary(model\$Anova)`. For example:

``````
library("afex")
data(md_12.1)
a1 <- aov_ez("id", "rt", md_12.1, within = c("angle", "noise"))

summary(a1\$Anova)
# Type III Repeated Measures MANOVA Tests:
#
# ------------------------------------------
#
# Term: (Intercept)
#
#  Response transformation matrix:
#            (Intercept)
# X0_absent            1
# X0_present           1
# X4_absent            1
# X4_present           1
# X8_absent            1
# X8_present           1
#
# Sum of squares and products for the hypothesis:
#             (Intercept)
# (Intercept)   116553960
#
# Multivariate Tests: (Intercept)
#                  Df test stat approx F num Df den Df     Pr(>F)
# Pillai            1   0.98518 598.4492      1      9 1.5266e-09 ***
# Wilks             1   0.01482 598.4492      1      9 1.5266e-09 ***
# Hotelling-Lawley  1  66.49435 598.4492      1      9 1.5266e-09 ***
# Roy               1  66.49435 598.4492      1      9 1.5266e-09 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# ------------------------------------------
#
# Term: angle
#
#  Response transformation matrix:
#            angle1 angle2
# X0_absent       1      0
# X0_present      1      0
# X4_absent       0      1
# X4_present      0      1
# X8_absent      -1     -1
# X8_present     -1     -1
#
# Sum of squares and products for the hypothesis:
#         angle1 angle2
# angle1 1128960 403200
# angle2  403200 144000
#
# Multivariate Tests: angle
#                  Df test stat approx F num Df den Df     Pr(>F)
# Pillai            1  0.887597 31.58624      2      8 0.00015963 ***
# Wilks             1  0.112403 31.58624      2      8 0.00015963 ***
# Hotelling-Lawley  1  7.896559 31.58624      2      8 0.00015963 ***
# Roy               1  7.896559 31.58624      2      8 0.00015963 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# ------------------------------------------
#
# Term: noise
#
#  Response transformation matrix:
#            noise1
# X0_absent       1
# X0_present     -1
# X4_absent       1
# X4_present     -1
# X8_absent       1
# X8_present     -1
#
# Sum of squares and products for the hypothesis:
#         noise1
# noise1 1713960
#
# Multivariate Tests: noise
#                  Df test stat approx F num Df den Df     Pr(>F)
# Pillai            1  0.789552 33.76596      1      9 0.00025597 ***
# Wilks             1  0.210448 33.76596      1      9 0.00025597 ***
# Hotelling-Lawley  1  3.751773 33.76596      1      9 0.00025597 ***
# Roy               1  3.751773 33.76596      1      9 0.00025597 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# ------------------------------------------
#
# Term: angle:noise
#
#  Response transformation matrix:
#            angle1:noise1 angle2:noise1
# X0_absent              1             0
# X0_present            -1             0
# X4_absent              0             1
# X4_present             0            -1
# X8_absent             -1            -1
# X8_present             1             1
#
# Sum of squares and products for the hypothesis:
#               angle1:noise1 angle2:noise1
# angle1:noise1        416160        171360
# angle2:noise1        171360         70560
#
# Multivariate Tests: angle:noise
#                  Df test stat approx F num Df den Df     Pr(>F)
# Pillai            1  0.918223 44.91353      2      8 4.4722e-05 ***
# Wilks             1  0.081777 44.91353      2      8 4.4722e-05 ***
# Hotelling-Lawley  1 11.228381 44.91353      2      8 4.4722e-05 ***
# Roy               1 11.228381 44.91353      2      8 4.4722e-05 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
#
#                   SS num Df Error SS den Df       F    Pr(>F)
# (Intercept) 19425660      1   292140      9 598.449 1.527e-09 ***
# angle         289920      2    64080     18  40.719 2.087e-07 ***
# noise         285660      1    76140      9  33.766  0.000256 ***
# angle:noise   105120      2    20880     18  45.310 9.424e-08 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#
# Mauchly Tests for Sphericity
#
#             Test statistic p-value
# angle              0.96011 0.84972
# angle:noise        0.89378 0.63814
#
#
# Greenhouse-Geisser and Huynh-Feldt Corrections
#  for Departure from Sphericity
#
#              GG eps Pr(>F[GG])
# angle       0.96164  3.402e-07 ***
# angle:noise 0.90398  3.454e-07 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#               HF eps   Pr(>F[HF])
# angle       1.217564 2.086763e-07
# angle:noise 1.117870 9.424093e-08
# Warning message:
# In summary.Anova.mlm(a1\$Anova, multivariate = TRUE) :
#   HF eps > 1 treated as 1``````

Hope that helps!