[R] Tukey HSD (or other post hoc tests) following repeated measures ANOVA

From: Ullrich Ecker <ullrich.ecker_at_uwa.edu.au>
Date: Wed, 28 May 2008 17:08:57 +0800


Hi everyone,

I am fairly new to R, and I am aware that others have had this problem before, but I have failed to solve the problem from previous replies I found in the archives.

As this is such a standard procedure in psychological science, there must be an elegant solution to this...I think.

I would much appreciate a solution that even I could understand... ;-)

Now, I want to calculate a post-hoc test following up a within-subjects ANOVA.

The dv is reaction time (RT), there is a 3-level Condition factor (Cond; within-subjects), a number of subjects (Subj), and the dataframe is called WMU3C.

The model is

> RT.aov <- aov(RT~Cond + Error(Subj/Cond), WMU3C)

I understand that TukeyHSD only works with an aov object, but that RT.aov is an aovlist object.

> class(RT.aov)

[1] "aovlist" "listof"

I've tried to work around it using the "maiz" example in the MMC documentation of the HH package (a solution previously recommended), but I couldn't get it to work: My best shot was to calculate another aov avoiding the error term (I don't see how this could be a feasible approach, but that's how I understood the MMC example) and a contrast vector (contrasting conditions 2 and 3):

I have to admit that I don't quite understand what I'm doing here (not that you couldn't tell)

> RT2.aov <- aov(terms(RT~Subj*Cond, WMU3C))
> Cond.lmat <- c(0,1,-1)
> Tukey <- glht.mmc(RT2.aov, focus = "Cond", focus.lmat = Cond.lmat)

yielding

Error in mvt(lower = carg$lower, upper = carg$upper, df = df, corr = carg$corr, :

   NA/NaN/Inf in foreign function call (arg 6) In addition: Warning message:
In cov2cor(covm) : diagonal has non-finite entries

> Tukey

       height

Thank you very much for your help!

Ullrich

Dr Ullrich Ecker
Postdoctoral Research Associate
Cognitive Science Laboratories
School of Psychology (Mailbag M304)
Room 211 Sanders Building
University of Western Australia
35 Stirling Hwy
Crawley WA 6009
Australia
Office: +61 8 6488 3266
Mobile: +61 4 5822 0072
Fax: +61 8 6488 1006
E-mail: ullrich.ecker_at_uwa.edu.au
Web: www.cogsciwa.com

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 28 May 2008 - 09:28:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 30 May 2008 - 08:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive