Let us first read the data as follows,
cloth = read.csv("C:/Users/Lenovo/OneDrive/Desktop/Cloth.csv", header = TRUE)
cloth
Here we will take bolts as blocks and chemicals as treatments. Now, the ANOVA table for RCBD is as follows,
r = c(t(as.matrix(cloth[,c(2:6)]))) # response data
r
## [1] 73 68 74 71 67 73 67 75 72 70 75 68 78 73 68 73 71 75 75 69
f = colnames(cloth[,c(2:6)]) # treatment levels
k = 5 # number of control blocks
n = 4 # number of treatment levels
blk = gl(k, 1, n*k, factor(f)) # blocking factor
blk
## [1] B1 B2 B3 B4 B5 B1 B2 B3 B4 B5 B1 B2 B3 B4 B5 B1 B2 B3 B4 B5
## Levels: B1 B2 B3 B4 B5
tm = gl(n, k, k*n) # matching treatment
tm
## [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4
## Levels: 1 2 3 4
av_rcbd = aov(r ~ tm + blk)
summary(av_rcbd)
## Df Sum Sq Mean Sq F value Pr(>F)
## tm 3 12.95 4.32 2.376 0.121
## blk 4 157.00 39.25 21.606 2.06e-05 ***
## Residuals 12 21.80 1.82
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Now, observe that, p-value for treatments = 0.121 > 0.05, so we accept null hypothesis at level 0.05. So, all treatments have same effects at level 0.05.
Now, the ANOVA table for completely randomized design (RCD) is as follows,
av_rcd = aov(r ~ tm)
summary(av_rcd)
## Df Sum Sq Mean Sq F value Pr(>F)
## tm 3 12.95 4.317 0.386 0.764
## Residuals 16 178.80 11.175
Now, observe that, p-value for treatments = 0.764 > 0.05, so we accept null hypothesis at level 0.05. So, all treatments have same effects at level 0.05.
Now, the efficiency for any design is defined as, \[ efficiency = \frac{1}{variance} = \frac{df}{SSE}, \text{ df = degrees of freedom} \]
Now the efficiency of RCBD and RCD are as follows,
eff_rcbd = 12/21.8
eff_rcbd
## [1] 0.5504587
eff_rcd = 16/178.8
eff_rcd
## [1] 0.08948546
As, RCBD has higher efficiency, so it’s better than RCD.
Let us first read the data as follows,
grain = read.csv("C:/Users/Lenovo/OneDrive/Desktop/Grain.csv", header = TRUE)
grain
Here we will take Furnance as blocks and stirring rate as treatments. Now, the RCBD is as follows,
r2 = c(t(as.matrix(grain[,c(2:5)]))) # response data
r2
## [1] 8 4 5 6 14 5 6 9 14 6 9 2 17 9 3 6
f2 = colnames(grain[,c(2:5)]) # block levels
k2 = 4 # number of control blocks
n2 = 4 # number of treatment levels
blk2 = gl(k2, 1, n2*k2, factor(f2)) # blocking factor
blk2
## [1] F1 F2 F3 F4 F1 F2 F3 F4 F1 F2 F3 F4 F1 F2 F3 F4
## Levels: F1 F2 F3 F4
tm2 = gl(n2, k2, k2*n2) # matching treatment
tm2
## [1] 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
## Levels: 1 2 3 4
av2_rcbd = aov(r2 ~ tm2 + blk2)
summary(av2_rcbd)
## Df Sum Sq Mean Sq F value Pr(>F)
## tm2 3 22.19 7.40 0.853 0.4995
## blk2 3 165.19 55.06 6.348 0.0133 *
## Residuals 9 78.06 8.67
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Now, observe that, p-value for treatments = 0.4995 > 0.05, so we accept null hypothesis at level 0.05. So, all treatments have same effects at level 0.05.
Now, the completely randomized design (RCD) is as follows,
av2_rcd = aov(r2 ~ tm2)
summary(av2_rcd)
## Df Sum Sq Mean Sq F value Pr(>F)
## tm2 3 22.19 7.396 0.365 0.78
## Residuals 12 243.25 20.271
Now, observe that, p-value for treatments = 0.78 > 0.05, so we accept null hypothesis at level 0.05. So, all treatments have same effects at level 0.05.
Now, the efficiency for any design is defined as, \[ efficiency = \frac{1}{variance} = \frac{df}{SSE}, \text{ df = degrees of freedom} \]
Now the efficiency of RCBD and RCD are as follows,
eff2_rcbd = 9/78.06
eff2_rcbd
## [1] 0.1152959
eff2_rcd = 12/243.25
eff2_rcd
## [1] 0.04933196
As, RCBD has higher efficiency, so it’s better than RCD.
As, the stirring rate doesn’t affect grain size, so engineer can choose any stirring rate as per economic requirements.