[R] Post Hoc Groupings

P Ehlers ehlers at math.ucalgary.ca
Thu Oct 27 02:23:14 CEST 2005



Jarrett Byrnes wrote:
> Quick question, as I attempt to learn R.  For post-hoc tests
> 
> 1) Is there an easy function that will take, say the results of 
> tukeyHSD and create a grouping table.  e.g., if I have treatments 1, 2, 
> and 3, with 1 and 2 being statistically the same and 3 being different 
> from both
> 
> Group	Treatment
> A		1
> A		2
> B		3
> 
> 2) I've been stumbling over the proper syntax for simple effects for a 
> tukeyHSD test.  Is it
> 
> TukeyHSD(model.aov, "Treatment1", "Treatment2")
> or
> TukeyHSD(model, c("Treatment1", "Treatment2"))
> 
> or something else, as neither of those seem to really work.
> 

Re question 2, using the example in the help file:
fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
TukeyHSD(fm1, c("wool","tension"))

Note that "wool", "tension" must be factors.

[In the help file for TukeyHSD, argument 'which' is
defined as a "list" of terms. Maybe that should be changed
to a "character vector".]

Peter




More information about the R-help mailing list