Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TukeyHSD after within factors ANOVA

Tags:

r

I run the following commands

a1 <- aov(Ratio~(Condition*Event) + Error(Participant/(Condition*Event)), Data)
summary(a1)

That outputs the correct results (ANOVA tables etc).

When I run:

TukeyHSD(a1,"Condition")

I get: Error in UseMethod("TukeyHSD") : no applicable method for "TukeyHSD"

Why does the ANOVA work, but not TukeyHSD? Both within factor variables are strings (Condition has 3 levels and Event has 4 levels).

EDIT: When I redo the aov without the Error term it works, however Tukey shows no significant difference between any of the pairs (The ANOVA was significant for Confidence). Does this mean that Tukey's is correcting for multiple comparisons?

like image 749
LDK Avatar asked Dec 21 '22 14:12

LDK


2 Answers

aov() with Error() returns a object with a class of "aovlist" "listof". TukeyHSD apparently doesn't have a method for either of those classes.

like image 160
kmm Avatar answered Jan 15 '23 22:01

kmm


As an alternative to traditional repeated-measures ANOVA for within-subject design, you might consider using linear mixed-effects approach. It is being increasingly used in the scientific community and avoids some of the ANOVA pitfalls while allowing for more complex error structures. With continuous response variable, the nlme package is enough, but you can also use lme4 which further allows to cope with categorical response variables. For multiple comparisons (including Tukey's post-hoc tests), then, the multcomp package (see the glht() function) can be used with mixed-effects models fitted with nlme::lme, as described here: Repeated Measures ANOVA using R.

One short remark about your design: If your response (dependent) variable, Ratio, is a proportion or a bounded value, you may think of using a different link function.

like image 25
chl Avatar answered Jan 15 '23 21:01

chl