Re: [R] visualize TukeyHSD results
Dear Timothy, Use library(agricolae) library(agricolae) a = aov(Weight~Feed) HSD.test(a,Feed) HSD.test(a,Feed, group=TRUE) HSD.test(a,Feed, group=FALSE) Regards, Felipe de Mendiburu. http://tarwi.lamolina.edu.pe/~fmendiburu International Potato Center. www.cipotato.org University: Agraria La Molina - Peru. www.lamolina.edu.pe -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Timothy Spier Sent: Thursday, October 21, 2010 9:50 PM To: r-help@r-project.org Subject: [R] visualize TukeyHSD results 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 difflwr 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 C73.4 a B71.3 a A64.6 b D63.2 b Any ideas? [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
[R] visualize TukeyHSD results
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 difflwr 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 C73.4 a B71.3 a A64.6 b D63.2 b Any ideas? [[alternative HTML version deleted]] __ R-help@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.
Re: [R] visualize TukeyHSD results
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 difflwr 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 C73.4 a B71.3 a A64.6 b D63.2 b Any ideas? [[alternative HTML version deleted]] __ R-help@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 __ R-help@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.