A research laboratory was developing a new compound for the relief of severe cases of hay fever. In an experiment with 36 volunteers, the amounts of two active ingredients (factors A and B) in the compound were varied at three levels each (LOW, MEDIUM, and HIGH). Randomization was used in assigning four volunteers to each of the nine treatment combinations.

fever <- read.csv("fever.txt", header = F, sep = "")
names(fever) <- c("response", "factor.A", "factor.B")
head(fever,4)
##   response factor.A factor.B
## 1      2.4      LOW      LOW
## 2      2.7      LOW      LOW
## 3      2.3      LOW      LOW
## 4      2.5      LOW      LOW

1- The plot for a visual inspection of the interaction between the ingredients A and B

with(fever, interaction.plot(factor.A, factor.B, response, fun = mean,
                             main = "Interaction Plot"))

The plot suggests that there is interaction between the levels of ingredient A and ingredient B because the distance between the means across the three levels are not the same.

2- Fitting the the two-way ANOVA

result <- aov(response ~ factor.A + factor.B + factor.A:factor.B, data = fever)
summary(result)
##                   Df Sum Sq Mean Sq F value Pr(>F)    
## factor.A           2 220.02  110.01  1827.9 <2e-16 ***
## factor.B           2 123.66   61.83  1027.3 <2e-16 ***
## factor.A:factor.B  4  29.42    7.36   122.2 <2e-16 ***
## Residuals         27   1.63    0.06                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The null hypothesis for the interactin is that “there is no interaction between the levels of ingredient A and ingredient B”. The alternative hypothesis is that “there is interaction”. The test statistic is F = 122.2 and the p.value is less than 0.05. Therefore, at the alpha level of 0.05, we reject the null hypothesis and conclude that there is significant interaction between the levels of ingredient A and ingredient B.

3- It is possible for the interaction to be significant when the main effects are not significant. So it makes sense to test the significance of the main effects. The null phpothesis for the main effect for A is that “the responses do not differ by the levels of factor A, while holding constant the levels of factor B and the interactions”. The null phpothesis for the main effect for B is that “the responses do not differ by the levels of factor A, while holding constant the levels of factor A and the interactions”. The test statistics for the main effetcs A and B are F = 1827.9 and F = 1027.3, respectively. the p-values are less than 0.05 for each. We reject the null hypothesis and conclude that the responses significantly differ across the levels of the two ingredients, while holding constant the other and the interactions.

4- Comparing the means of the three levels separately for the two ingredients using Tukey’s method

TukeyHSD(result, which = "factor.A") # ingredient A
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = response ~ factor.A + factor.B + factor.A:factor.B, data = fever)
## 
## $factor.A
##              diff       lwr       upr p adj
## LOW-HIGH    -5.95 -6.198324 -5.701676     0
## MEDIUM-HIGH -2.00 -2.248324 -1.751676     0
## MEDIUM-LOW   3.95  3.701676  4.198324     0
TukeyHSD(result, which = "factor.B") # ingredient B
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = response ~ factor.A + factor.B + factor.A:factor.B, data = fever)
## 
## $factor.B
##              diff       lwr        upr p adj
## LOW-HIGH    -4.35 -4.598324 -4.1016759     0
## MEDIUM-HIGH -1.05 -1.298324 -0.8016759     0
## MEDIUM-LOW   3.30  3.051676  3.5483241     0

All pairwise con mparisons are significant with their adjusted p-values less than 0.05.