Question 1


Data


  • 3 levels of factor
  • alpha = 0.05
  • Power: 0.75
  • mean difference 0.8 of std dev = f
  • Output: randomized data collection table.
  • Completely Randomized Design


Determination of the sample size


pwr.anova.test(k=3,n=NULL,f=0.8,sig.level=0.05, power=0.75)
## 
##      Balanced one-way analysis of variance power calculation 
## 
##               k = 3
##               n = 5.599404
##               f = 0.8
##       sig.level = 0.05
##           power = 0.75
## 
## NOTE: n is number in each group


The sample for each level will be 6 (n=6)


Randomized data collection table


trt1 <- c("lvl1","lvl2","lvl3")
design<-design.crd(trt=trt1,r=6, seed=872598)
design$book
##    plots r trt1
## 1    101 1 lvl1
## 2    102 1 lvl2
## 3    103 1 lvl3
## 4    104 2 lvl1
## 5    105 2 lvl2
## 6    106 3 lvl2
## 7    107 4 lvl2
## 8    108 3 lvl1
## 9    109 2 lvl3
## 10   110 3 lvl3
## 11   111 5 lvl2
## 12   112 4 lvl1
## 13   113 4 lvl3
## 14   114 5 lvl3
## 15   115 6 lvl3
## 16   116 5 lvl1
## 17   117 6 lvl1
## 18   118 6 lvl2


The value of seed is: 872598


Question 2


Data


  • 4 levels of factor
  • 24 observations (total)
  • 6 blocks

Randomized data collection table


trt2 <- c("lvl1","lvl2","lvl3","lvl4")
design2<-design.rcbd(trt2,6,seed=667595)
design2$book
##    plots block trt2
## 1    101     1 lvl4
## 2    102     1 lvl3
## 3    103     1 lvl2
## 4    104     1 lvl1
## 5    201     2 lvl3
## 6    202     2 lvl2
## 7    203     2 lvl1
## 8    204     2 lvl4
## 9    301     3 lvl4
## 10   302     3 lvl3
## 11   303     3 lvl2
## 12   304     3 lvl1
## 13   401     4 lvl3
## 14   402     4 lvl2
## 15   403     4 lvl4
## 16   404     4 lvl1
## 17   501     5 lvl3
## 18   502     5 lvl2
## 19   503     5 lvl1
## 20   504     5 lvl4
## 21   601     6 lvl4
## 22   602     6 lvl3
## 23   603     6 lvl1
## 24   604     6 lvl2


The value of seed is: 667595


Question 3


Randomized data collection table


Paint<-c(rep(1,9),rep(2,9))
vec<-c(20,25,30)
DTime<-c(rep(vec,6))
Obs<-c(74,73,78,64,61,85,50,44,92,92,98,66,86,73,45,68,88,85)
data.frame(Paint,DTime,Obs)
##    Paint DTime Obs
## 1      1    20  74
## 2      1    25  73
## 3      1    30  78
## 4      1    20  64
## 5      1    25  61
## 6      1    30  85
## 7      1    20  50
## 8      1    25  44
## 9      1    30  92
## 10     2    20  92
## 11     2    25  98
## 12     2    30  66
## 13     2    20  86
## 14     2    25  73
## 15     2    30  45
## 16     2    20  68
## 17     2    25  88
## 18     2    30  85
Paint<-as.fixed(Paint)
DTime<-as.fixed(DTime)
mod<-lm(Obs~Paint+DTime+Paint*DTime)
gad(mod)
## Analysis of Variance Table
## 
## Response: Obs
##             Df  Sum Sq Mean Sq F value  Pr(>F)  
## Paint        1  355.56  355.56  1.9025 0.19296  
## DTime        2   27.44   13.72  0.0734 0.92962  
## Paint:DTime  2 1878.78  939.39  5.0265 0.02596 *
## Residual    12 2242.67  186.89                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction.plot(DTime,Paint,Obs)


Conclusion

We conclude that the surface finish of metal parts is influenced by the type of paint used and the drying time. This can be seen in the plot, as the lines for both paints interfere between 25 and 30 minutes.


CODE USED

install.packages("agricolae")
library(agricolae)
library(pwr)
library(GAD)
pwr.anova.test(k=3,n=NULL,f=0.8,sig.level=0.05, power=0.75)
trt1 <- c("lvl1","lvl2","lvl3")
design<-design.crd(trt=trt1,r=6, seed=872598)
design$book
trt2 <- c("lvl1","lvl2","lvl3","lvl4")
design2<-design.rcbd(trt2,6,seed=667595)
design2$book
Paint<-c(rep(1,9),rep(2,9))
vec<-c(20,25,30)
DTime<-c(rep(vec,6))
Obs<-c(74,73,78,64,61,85,50,44,92,92,98,66,86,73,45,68,88,85)
data.frame(Paint,DTime,Obs)
Paint<-as.fixed(Paint)
DTime<-as.fixed(DTime)
mod<-lm(Obs~Paint+DTime+Paint*DTime)
gad(mod)
interaction.plot(DTime,Paint,Obs)