Research Question:

The research question is “There is a significant difference between the 3 brewing methods in terms of the amount of creme it creates.

Hypothesis:  H0: there is no difference in terms of the amount of creme among the 3 brewing methods.  H1: there is at least 1 brewing method differs than the others in terms of the amount of creme being created.

Codes:

Normality:

library("moments")
agostino.test(espresso_data$cereme)
## 
##  D'Agostino skewness test
## 
## data:  espresso_data$cereme
## skew = 0.54679, z = 1.32787, p-value = 0.1842
## alternative hypothesis: data have a skewness
shapiro.test(espresso_data$cereme)
## 
##  Shapiro-Wilk normality test
## 
## data:  espresso_data$cereme
## W = 0.92201, p-value = 0.04414
qqnorm(espresso_data$cereme)

Independence of observations

eruption.lm = lm(espresso_data$cereme ~ espresso_data$brewmethod, data=espresso_data)
eruption.res = resid(eruption.lm)
plot(espresso_data$brewmethod, eruption.res, ylab="Residuals", xlab="group", main="Scatterplot of Residuals")
abline(0, 0)

Variance Equality

bartlett.test(espresso_data$cereme, espresso_data$brewmethod)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  espresso_data$cereme and espresso_data$brewmethod
## Bartlett's K-squared = 0.96331, df = 2, p-value = 0.6178
tapply(espresso_data$cereme, espresso_data$brewmethod, var)
##         1         2         3 
##  53.29088 102.02220  59.30182

One-way Anova Analysis

model <- aov(espresso_data$cereme ~ factor(espresso_data$brewmethod), data = espresso_data)
summary(model)
##                                  Df Sum Sq Mean Sq F value  Pr(>F)    
## factor(espresso_data$brewmethod)  2   4065  2032.6   28.41 4.7e-07 ***
## Residuals                        24   1717    71.5                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Post-hoc Tests:

pairwise.t.test(espresso_data$cereme, espresso_data$brewmethod, paired = FALSE,
p.adjust.method = "bonferron")
## 
##  Pairwise comparisons using t tests with pooled SD 
## 
## data:  espresso_data$cereme and espresso_data$brewmethod 
## 
##   1       2      
## 2 5.2e-07 -      
## 3 0.24    4.4e-05
## 
## P value adjustment method: bonferroni
kruskal.test(espresso_data$cereme~factor(espresso_data$brewmethod), data = espresso_data)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  espresso_data$cereme by factor(espresso_data$brewmethod)
## Kruskal-Wallis chi-squared = 16.646, df = 2, p-value = 0.0002429
model <- aov(espresso_data$cereme ~ as.factor(espresso_data$brewmethod), data = espresso_data)
TukeyHSD(model, conf.level = 0.95)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = espresso_data$cereme ~ as.factor(espresso_data$brewmethod), data = espresso_data)
## 
## $`as.factor(espresso_data$brewmethod)`
##      diff        lwr       upr     p adj
## 2-1  28.9  18.942931  38.85707 0.0000005
## 3-1   7.3  -2.657069  17.25707 0.1811000
## 3-2 -21.6 -31.557069 -11.64293 0.0000419

Summary:

Observations from the study were analyzed by conducting a one-way analysis of variance using R version 3.6.1. First, all assumptions are met and there is no adjustment made. Results suggest that the amount of creme generated was affected by different brewing method (p < .001).

Continue the discussion with specifically which groups differed, a Tukey’s hoc test was established. The result suggested that there is a significant difference between the 3rd and 2nd brewing method (p < .001) and the 2nd and the 1st brewing method (p < .001), in terms of the amount of creme created.