fat = c(64, 72, 68, 77, 56, 95,
78, 91, 97, 82, 85, 77,
75, 93, 78, 71, 63, 76,
55, 66, 49, 64, 70, 68)
fat_type = c(rep("Fat1",6), rep("Fat2",6), rep("Fat3",6), rep("Fat4",6))
fat_dat = data.frame(fat, fat_type)
plot(fat ~ fat_type, data=fat_dat)
We can see from the boxplots that there is a significance difference between Fat2 and Fat4. There is a difference between Fat1 and Fat3 but it is not significant. Same with comparing to Fat4.
results = aov(fat ~ fat_type, data=fat_dat)
summary(results)
Df Sum Sq Mean Sq F value Pr(>F)
fat_type 3 1636 545.5 5.406 0.00688 **
Residuals 20 2018 100.9
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
The Null Hypothesis is all the fat will be absorbed by donut equally. The Alternative Hypothesis is at least one fat will be absorbed by the donut. We find the the P value to be small, so we reject the Null Hypothesis. There is at least one fat that will be absorbed by the donut.
pairwise.t.test(fat, fat_type, p.adjust="bonferroni")
Pairwise comparisons using t tests with pooled SD
data: fat and fat_type
Fat1 Fat2 Fat3
Fat2 0.2189 - -
Fat3 1.0000 0.8182 -
Fat4 0.6005 0.0046 0.1529
P value adjustment method: bonferroni
We see a level of signigicance between Fat4 and Fat2, with a p value smaller than 0.05.
TukeyHSD(results, conf.level =0.95)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = fat ~ fat_type, data = fat_dat)
$fat_type
diff lwr upr p adj
Fat2-Fat1 13 -3.232221 29.232221 0.1461929
Fat3-Fat1 4 -12.232221 20.232221 0.8998057
Fat4-Fat1 -10 -26.232221 6.232221 0.3378150
Fat3-Fat2 -9 -25.232221 7.232221 0.4270717
Fat4-Fat2 -23 -39.232221 -6.767779 0.0039064
Fat4-Fat3 -14 -30.232221 2.232221 0.1065573
Same with pairwise t test, we see a level of significance with the difference between Fat4 and Fat2, with a p value that is less than 0.05.