Design of Experiments Latin Sqaures
The yield of a chemical process was measured using five batches of raw material, five acid concentrations (AC), five standing times (A, B, C, D, E), and five catalyst concentrations \((\alpha,\beta,\gamma, \delta,\epsilon)\) . The Graeco-Latin square that follows was used. Analyze the data from this experiment (use \(\alpha=0.05\) ) and draw conclusions.
knitr:: kable (tibble:: tribble (
~ V1, ~ V2, ~ V3, ~ V4, ~ V5,~ V6,
"1" , "A$ \\ alpha$=26" , "B$ \\ beta$=16" , "C$ \\ gamma$=19" ,"D$ \\ delta$=16" ,"E$ \\ epsilon=13$" ,
"2" , "B$ \\ gamma$=18" , "C$ \\ delta$=21" , "D$ \\ epsilon$=18" ,"E$ \\ alpha$=11" ,"A$ \\ beta$=21" ,
"3" , "C$ \\ epsilon$=20" , "D$ \\ alpha$=12" , "E$ \\ beta$=16" ,"A$ \\ gamma$=25" ,"B$ \\ delta$=13" ,
"4" , "D$ \\ beta$=15" , "E$ \\ gamma$=15" , "A$ \\ delta$=22" ,"B$ \\ epsilon$=14" ,"C$ \\ alpha$=17" ,
"5" , "E$ \\ delta$=10" ,"A$ \\ epsilon$=24" ,"B$ \\ alpha$=17" ,"C$ \\ beta$=17" ,"D$ \\ gamma$=14" ), col.names = c ("Batch" , "AC 1" ,"AC 2" , "AC 3" , "AC 4" ,"AC 5" ))
1
A\(\alpha\) =26
B\(\beta\) =16
C\(\gamma\) =19
D\(\delta\) =16
E\(\epsilon=13\)
2
B\(\gamma\) =18
C\(\delta\) =21
D\(\epsilon\) =18
E\(\alpha\) =11
A\(\beta\) =21
3
C\(\epsilon\) =20
D\(\alpha\) =12
E\(\beta\) =16
A\(\gamma\) =25
B\(\delta\) =13
4
D\(\beta\) =15
E\(\gamma\) =15
A\(\delta\) =22
B\(\epsilon\) =14
C\(\alpha\) =17
5
E\(\delta\) =10
A\(\epsilon\) =24
B\(\alpha\) =17
C\(\beta\) =17
D\(\gamma\) =14
First we will try to solve the problem implementing the formula.
order= rep (1 : 4 ,each= 4 )
operator= rep (1 : 4 ,4 )
method= c ("C" ,"D" ,"A" ,"B" , "B" ,"C" ,"D" ,"A" ,"A" ,"B" ,"C" ,"D" ,
"D" ,"A" ,"B" ,"C" )
time= c (10 ,14 ,7 ,8 ,7 ,18 ,11 ,8 ,5 ,10 ,11 ,9 ,10 ,10 ,12 ,14 )
data= data.frame (order,operator,method,time)
head (data)
order operator method time
1 1 1 C 10
2 1 2 D 14
3 1 3 A 7
4 1 4 B 8
5 2 1 B 7
6 2 2 C 18
'data.frame': 16 obs. of 4 variables:
$ order : int 1 1 1 1 2 2 2 2 3 3 ...
$ operator: int 1 2 3 4 1 2 3 4 1 2 ...
$ method : chr "C" "D" "A" "B" ...
$ time : num 10 14 7 8 7 18 11 8 5 10 ...
data[,c (1 ,2 )]= lapply (data[,c (1 ,2 )],factor)
str (data)
'data.frame': 16 obs. of 4 variables:
$ order : Factor w/ 4 levels "1","2","3","4": 1 1 1 1 2 2 2 2 3 3 ...
$ operator: Factor w/ 4 levels "1","2","3","4": 1 2 3 4 1 2 3 4 1 2 ...
$ method : chr "C" "D" "A" "B" ...
$ time : num 10 14 7 8 7 18 11 8 5 10 ...
mean_order= aggregate (data$ time,list (data$ order),mean)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
mean_order= data %>% group_by (order) %>% summarise_at (vars (time), list (mean = mean,SD= sd))
mean_order
# A tibble: 4 × 3
order mean SD
<fct> <dbl> <dbl>
1 1 9.75 3.10
2 2 11 4.97
3 3 8.75 2.63
4 4 11.5 1.91
boxplot (time~ order,data = data,main= "Box Plot of Time aganist Order" , xlab= "Order" ,ylab= "Time" )
mean_operator= data %>% group_by (operator) %>% summarise_at (vars (time), list (mean = mean,SD= sd))
mean_operator
# A tibble: 4 × 3
operator mean SD
<fct> <dbl> <dbl>
1 1 8 2.45
2 2 13 3.83
3 3 10.2 2.22
4 4 9.75 2.87
boxplot (time~ operator,data = data,main= "Box Plot of Time aganist Operator" , xlab= "Operator" ,ylab= "Time" )
mean_method= data %>% group_by (method) %>% summarise_at (vars (time), list (mean = mean,SD= sd))
mean_method
# A tibble: 4 × 3
method mean SD
<chr> <dbl> <dbl>
1 A 7.5 2.08
2 B 9.25 2.22
3 C 13.2 3.59
4 D 11 2.16
boxplot (time~ method,data = data,main= "Box Plot of Time aganist Method" , xlab= "Method" ,ylab= "Time" )
data[,c (1 ,2 ,3 )]= lapply (data[,c (1 ,2 ,3 )],factor)
str (data)
'data.frame': 16 obs. of 4 variables:
$ order : Factor w/ 4 levels "1","2","3","4": 1 1 1 1 2 2 2 2 3 3 ...
$ operator: Factor w/ 4 levels "1","2","3","4": 1 2 3 4 1 2 3 4 1 2 ...
$ method : Factor w/ 4 levels "A","B","C","D": 3 4 1 2 2 3 4 1 1 2 ...
$ time : num 10 14 7 8 7 18 11 8 5 10 ...
p= 4
SS_method <- sum (aggregate (time ~ method, data = data, sum)$ time^ 2 )/ p- sum (data$ time)^ 2 / (p^ 2 )
SS_method
SS_order= sum ((aggregate (time~ order,data,sum)$ time)^ 2 )/ p- (sum (data$ time)^ 2 )/ (p^ 2 )
SS_order
SS_operator= sum ((aggregate (time~ operator,data,sum)$ time)^ 2 )/ p- (sum (data$ time)^ 2 )/ (p^ 2 )
SS_operator
SS_total= sum (data$ time^ 2 )- (sum (data$ time))^ 2 / (p^ 2 )
SS_total
SS_error= SS_total- SS_order- SS_operator- SS_method
SS_error
Now we shall compute various mean sum of squares
MS_order= SS_order/ (p-1 )
MS_order
MS_operator= SS_operator/ (p-1 )
MS_operator
MS_method= SS_method/ (p-1 )
MS_method
MS_error= SS_error/ (p^ 2-3 * (p-1 )- 1 )
MS_error
F_method= MS_method/ MS_error
F_method
F_order= MS_order/ MS_error
F_order
F_operator= MS_operator/ MS_error
F_operator
pvalue_method= 1 - pf (F_method,p-1 ,p^ 2-3 * (p-1 )- 1 )
pvalue_method
pvalue_order= 1 - pf (F_order,p-1 ,p^ 2-3 * (p-1 )- 1 )
pvalue_order
pvalue_operator= 1 - pf (F_operator,p-1 ,p^ 2-3 * (p-1 )- 1 )
pvalue_operator
ANOVA Table for Latin Square
Method
72.5
3
24.1666667
13.8095238
0.004213
Order
18.5
3
6.1666667
3.5238095
0.0885187
Operator
51.5
3
17.1666667
9.8095238
0.0099259
Error
10.5
6
1.75
Total
153
15
Direct Execution of Latin Sqaure in R
[,1] [,2] [,3] [,4]
[1,] 10 7 5 10
[2,] 14 18 10 10
[3,] 7 11 11 12
[4,] 8 8 9 14
[,1] [,2] [,3] [,4]
[1,] "C" "B" "A" "D"
[2,] "D" "C" "B" "A"
[3,] "A" "D" "C" "B"
[4,] "B" "A" "D" "C"
model= lm (time~ order+ operator+ method,data= data)
anova (model)
Analysis of Variance Table
Response: time
Df Sum Sq Mean Sq F value Pr(>F)
order 3 18.5 6.1667 3.5238 0.088519 .
operator 3 51.5 17.1667 9.8095 0.009926 **
method 3 72.5 24.1667 13.8095 0.004213 **
Residuals 6 10.5 1.7500
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1