Interpretation of TukeyHSD (using HW03 exam01.R for eample)

1. Tukey HSD, simple version

This version of Tukey HSD will compute the mean comparison between 3 group. You will get the result table below. The values of “diff” column on the table are the mean difference between 2 groups. “lwr” giving the lower end point of the interval, “upr” giving the upper end point and “p adj” giving the p-value after adjustment for the multiple comparisons. If the interval between “lwr” and “upr” doesn’t involve 0, we will say these two group means may be different. Or you can see the “p adj”. If the value of “p adj” < .05, we will conclude these two two group means may be different.

TukeyHSD(aov(rst),conf.level=0.95)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = rst)
## 
## $grp
##             diff        lwr      upr     p adj
## 2-1 7.105427e-15 -4.2007814 4.200781 1.0000000
## 3-1 4.000000e+00 -0.2007814 8.200781 0.0591479
## 3-2 4.000000e+00  0.2427069 7.757293 0.0400434

2. Tukey HSD, complicated, flexible

On this version, you can find “Groups, Treatments and means” matrix on the bottom of the result table below. The value of first column of “Groups, Treatments and means” are “a,ab,b”. If two group means are the same, you will see the same letter. The second column are group number. The other column are gruop means. So the first column of group 3 and 1 are “a” and “ab”. They all have the letter “a” and indicate there is no difference between this two group means. But group 3 and group 2 are “a” and “b”, these two group means may be different. You can also see the same matrix when you run “Scheffe” analysis.

df <- anova(rst)['Df']['Residuals',]
MSerror <- anova(rst)['Mean Sq']['Residuals',]
HSD.test(dta$x, dta$grp, df, MSerror,console=TRUE)
## 
## Study: dta$x ~ dta$grp
## 
## HSD Test for dta$x 
## 
## Mean Square Error:  2 
## 
## dta$grp,  means
## 
##   dta.x      std r Min Max
## 1    13 1.414214 2  12  14
## 2    13 1.732051 3  11  14
## 3    17 1.000000 3  16  18
## 
## alpha: 0.05 ; Df Error: 5 
## Critical Value of Studentized Range: 4.601725 
## 
## Harmonic Mean of Cell Sizes  2.571429
## Honestly Significant Difference: 4.05834 
## 
## Means with the same letter are not significantly different.
## 
## Groups, Treatments and means
## a     3   17 
## ab    1   13 
## b     2   13