[R] visualize TukeyHSD results

Spencer Graves spencer.graves at structuremonitoring.com
Fri Oct 22 05:00:00 CEST 2010


install.packages('sos' ) # if you do not have it already
library(sos)
hsd <- ???TukeyHSD # 27 matches
summary(hsd) # in 12 packages
hsd # open the results in a browser.
# Note especially the second package multcompView
# The multcomp package with 2 matches has a companion book
# Frank Bretz, Torsten Hothorn and Peter Westfall (2010), Multiple 
Comparisons Using R, CRC Press, Boca Raton.


       Hope this helps.
       Spencer Graves


On 10/21/2010 7:50 PM, Timothy Spier wrote:
> I am a new R user but a long time SAS user. I searched for a response to this question but no luck, so forgive me if this topic has been covered before. I am running a TukeyHSD post hoc test after running an ANOVA. I get the results of all pairwise comparisons, no problem. However, the output table is a little "busy", and I'd like to make the output easier to read. Specifically, I would like all groups which are not significantly different to be given the same letter.
>
> For example, here is a simple ANOVA with Tukey post hoc. It compares weight gain in pigs among 4 feeds labeled "A", "B", "C", and "D":
>
>> a = aov(Weight~Feed)
>> TukeyHSD(a)
>    Tukey multiple comparisons of means
>      95% family-wise confidence level
>
> Fit: aov(formula = Weight ~ Feed)
>
> $Feed
>        diff        lwr       upr     p adj
> B-A   6.68   1.096263 12.263737 0.0168421
> C-A   8.73   2.807553 14.652447 0.0034914
> D-A  -1.38  -6.963737  4.203737 0.8906642
> C-B   2.05  -3.872447  7.972447 0.7530266
> D-B  -8.06 -13.643737 -2.476263 0.0041505
> D-C -10.11 -16.032447 -4.187553 0.0009497
>
>
>
> What I really want would look something like this:
>
> Feed         Mean     TukeyResult
> C            73.4           a
> B            71.3           a
> A            64.6           b
> D            63.2           b
>
>
> Any ideas?
>   		 	   		
> 	[[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.
>
>


-- 
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567



More information about the R-help mailing list