Isye 6421: Biostatistics: Analysis of Variance (Anova) Pairwise Comparison For Confidence Intervals

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

ISyE 6421: Biostatistics

Analysis of Variance (ANOVA)


• Pairwise Comparison for Confidence
Intervals:
➢Tukey’s ‘Honest Significant Difference’
method (TukeyHSD in R)

1
Recall Our Example

Group 1 2 3 4
65 75 59 94
87 69 78 89
73 81 67 80
79 62 88

76 75 66.5 87.75

Questions:
• One might guess that 𝝁𝟒 > 𝝁𝟏 > 𝝁𝟐 > 𝝁𝟑 , but are they
statistically significantly different?
• We need to adjust multiple comparisons.
2
Multiple Comparison

The 100(1-)% CI on 𝝁𝒊 − 𝝁𝒌 are given by


𝟏 𝟏
ഥ ഥ ෝ
𝒀𝒊⋅ − 𝒀𝒌⋅ ± 𝑪 𝝈 +
𝒏𝒊 𝒏𝒌
• Two-group comparison: For a given pair,
𝑪 = 𝒕𝜶,𝒏 +𝒏
𝟐 𝒊 𝒌 −𝟐

• Multiple comparison in ANOVA:


𝑪 = 𝒕 𝜶 ,𝒏−𝒓
𝟐𝑵

3
Tukey Method

In one-way ANOVA, the 100(1-)%


simultaneous CIs on 𝝁𝒊 − 𝝁𝒌 are given by
𝟏 𝟏
ഥ ഥ ෝ
𝒀𝒊⋅ − 𝒀𝒌⋅ ± 𝑪 𝝈 +
𝒏𝒊 𝒏𝒌
• Tukey’s ‘Honest Significant Difference’
Method defines that
𝐂 = 𝒒𝟏−𝜶,𝒓,𝒏−𝒓 𝟐
where q is the studentized range distribution
quantile.
• In R, call the function TukeyHSD()

4
R code for one-way ANOVA

score <- c(65, 87, 73, 79, 75, 69, 81, 59, 78, 67, 62,
94, 89, 80, 88)
type <- as.factor(c(rep(1,4), rep(2,3), rep(3,4), rep(4,4)));
score.aov <- aov(score ~ type)
summary(score.aov)

Df Sum Sq Mean Sq F value Pr(>F)


type 3 913.8 304.62 5.221 0.0175 *
Residuals 11 641.8 58.34
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ‘ 1

5
TukeyHSD(score.aov,conf.level=0.95)

TukeyHSD(score.aov, conf.level=0.95)
## Output
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = score ~ type)
$type
diff lwr upr p adj
2-1 -1.00 -18.556836 16.556836 0.9980975
3-1 -9.50 -25.754471 6.754471 0.3416067
4-1 11.75 -4.504471 28.004471 0.1898345
3-2 -8.50 -26.056836 9.056836 0.4929037
4-2 12.75 -4.806836 30.306836 0.1869988
4-3 21.25 4.995529 37.504471 0.0106831
6
Bonferroni vs Tukey
The CIs for i-k are of the form
𝟏 𝟏
ഥ 𝒊⋅ − 𝒀
𝒀 ഥ 𝒌⋅ ± 𝑪 +
𝒏𝒊 𝒏𝒌

Bonferroni Tukey
1-2 (-17.3, 19.3) (-16.6, 18.6)
1-3 (-7.5, 26.5) (-6.8,25.8)
1-4 (-28.7,5.2) (-28.0,4.5)
2-3 (-9.8, 26.8) (-9.1, 26.1)
2-4 (-31.1,5.6) (-30.3,4.8)
3-4 (-38.2,-4.3) (-37.5,-5.0)

7
Conclusion from TukeyHSD

Group 1 2 3 4
65 75 59 94
87 69 78 89
73 81 67 80
79 62 88

76 75 66.5 87.75

Conclusions:
• 𝝁𝟒 > 𝝁𝟑
• 𝝁𝟑 = 𝝁𝟏 = 𝝁𝟐
• 𝝁𝟒 = 𝝁𝟏 = 𝝁𝟐
8
plot(TukeyHSD(score.aov,conf.level=0.95))

9
Summary

• Multiple Comparisons: TukeyHSD

• Two useful commends in R:


➢ TukeyHSD(score.aov,conf.level=0.95)
➢ plot(TukeyHSD(score.aov,conf.level=0.95))

10

You might also like