The effect of five different methods (A, B, C, D, E) on the time to assemble a device is being studied. The experimenter wants to investigate how long each method takes with each of 4 workers. Also, since workers might get tired or get more practiced, they might slow down or speed up near the end. Therefore, the order that each worker tries a method also matters. Then, the experimenter decides to run the experiment as a Latin square so that worker and order effects may be systematically controlled. The data was recorded below.
#import data
library(readr)
data <- read_csv("/Volumes/GoogleDrive/My Drive/NORATIKAH/EDA/coding/Exercise 3.4.csv")
── Column specification ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
cols(
Order = col_double(),
Worker = col_double(),
Treatment = col_character(),
Time = col_double()
)
data
Treatment = as.factor(data$Treatment)
Row = as.factor(data$Order)
Column = as.factor(data$Worker)
results = aov(Time~Row+Column+Treatment,data)
summary(results)
Df Sum Sq Mean Sq F value Pr(>F)
Row 3 18.5 6.167 3.524 0.08852 .
Column 3 51.5 17.167 9.810 0.00993 **
Treatment 3 72.5 24.167 13.810 0.00421 **
Residuals 6 10.5 1.750
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
TukeyHSD(results)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Time ~ Row + Column + Treatment, data = data)
$Row
diff lwr upr p adj
2-1 1.25 -1.9881345 4.4881345 0.5756823
3-1 -1.00 -4.2381345 2.2381345 0.7191024
4-1 1.75 -1.4881345 4.9881345 0.3304308
3-2 -2.25 -5.4881345 0.9881345 0.1761447
4-2 0.50 -2.7381345 3.7381345 0.9474067
4-3 2.75 -0.4881345 5.9881345 0.0924529
$Column
diff lwr upr p adj
2-1 5.00 1.7618655 8.23813449 0.0070204
3-1 2.25 -0.9881345 5.48813449 0.1761447
4-1 1.75 -1.4881345 4.98813449 0.3304308
3-2 -2.75 -5.9881345 0.48813449 0.0924529
4-2 -3.25 -6.4881345 -0.01186551 0.0492740
4-3 -0.50 -3.7381345 2.73813449 0.9474067
$Treatment
diff lwr upr p adj
B-A 1.75 -1.4881345 4.9881345 0.3304308
C-A 5.75 2.5118655 8.9881345 0.0034505
D-A 3.50 0.2618655 6.7381345 0.0363534
C-B 4.00 0.7618655 7.2381345 0.0202927
D-B 1.75 -1.4881345 4.9881345 0.3304308
D-C -2.25 -5.4881345 0.9881345 0.1761447
plot(TukeyHSD(results))
The sigificant par of treatments are : C-A, D-A, and C-B. The most significant treatment is the pair of method C and A.