In total there are 21 students, 7 who are males and 14 who are females. One notices that by removing Q(uentin), a 27 year old male, one can match up persons evenly to be of the same gender and same age. To randomize the natural pairings, notice that A(drian) and G(regory) — who are 19 year old males — and L(inda) and E(sther) — who are 28 year old females — are forced.
This leaves the following three blocks to randomize.
Male, 20, D, M, J, P;
Female, 19, K, S, C, N;
Female, 20, B, O, I, R, H, T, U, F;
The following code produces randomizations.
set.seed(150000760)
print(sample(c("D", "M", "J", "P")))
## [1] "D" "P" "J" "M"
print(sample(c("K", "S", "C", "N")))
## [1] "N" "K" "S" "C"
print(sample(c("B", "O", "I", "R", "H", "T", "U", "F")))
## [1] "O" "T" "F" "R" "B" "H" "U" "I"
This forms the following blocks.
DP
JM
NK
SC
OT
FR
BH
UI
LE
AG
We would like one person within each block to receive a Z(izzaway) and another to receive a W(akey-Wakey). Do this as follows.
set.seed(931)
for (i in 1:10){
print(paste("In block", i, ",", sample(c("Person1", "Person2"), 1), "receives Zizzaway"))
}
## [1] "In block 1 , Person2 receives Zizzaway"
## [1] "In block 2 , Person1 receives Zizzaway"
## [1] "In block 3 , Person2 receives Zizzaway"
## [1] "In block 4 , Person2 receives Zizzaway"
## [1] "In block 5 , Person1 receives Zizzaway"
## [1] "In block 6 , Person2 receives Zizzaway"
## [1] "In block 7 , Person1 receives Zizzaway"
## [1] "In block 8 , Person2 receives Zizzaway"
## [1] "In block 9 , Person2 receives Zizzaway"
## [1] "In block 10 , Person2 receives Zizzaway"
P receives Z
J receives Z
K receives Z
C receives Z
O receives Z
R receives Z
B receives Z
I receives Z
E receives Z
G receives Z
After this, we want to randomize all of the participants.
set.seed(294)
sample(c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K",
"L", "M", "N", "O", "P", "R", "S", "T", "U"))
## [1] "N" "J" "E" "I" "P" "L" "G" "S" "D" "T" "H" "O" "M" "R" "U" "F" "K" "A" "C"
## [20] "B"
Putting all of this together produces the following plan.
To read the table, for example, on day 5, one would have student P take pill Z. We would encourage the professor to consider a blinded experiment, and to come back to us for statistical analysis.
Within each block, we have 12 treatments, which is a permutation of the array \([1,1,1,1,2,3,4,5,6,7,8,9]\). Per above we can randomize this array using the sample function. Filling in the plot map from right to left, but as an example, we assume each plot is a \(3 \times 4\) grid. Then we have the following four plots.
set.seed(67)
plot1 <- sample(c(1,1,1,1,2,3,4,5,6,7,8,9))
plot2 <- sample(c(1,1,1,1,2,3,4,5,6,7,8,9))
plot3 <- sample(c(1,1,1,1,2,3,4,5,6,7,8,9))
plot4 <- sample(c(1,1,1,1,2,3,4,5,6,7,8,9))
print("Plot 1")
## [1] "Plot 1"
print(matrix(plot1,nrow = 3,ncol = 4))
## [,1] [,2] [,3] [,4]
## [1,] 8 4 3 9
## [2,] 1 2 6 1
## [3,] 1 7 5 1
print("Plot 2")
## [1] "Plot 2"
print(matrix(plot2,nrow = 3,ncol = 4))
## [,1] [,2] [,3] [,4]
## [1,] 1 5 3 6
## [2,] 7 2 8 9
## [3,] 4 1 1 1
print("Plot 3")
## [1] "Plot 3"
print(matrix(plot3,nrow = 3,ncol = 4))
## [,1] [,2] [,3] [,4]
## [1,] 2 1 3 9
## [2,] 4 8 1 5
## [3,] 1 7 6 1
print("Plot 4")
## [1] "Plot 4"
print(matrix(plot4,nrow = 3,ncol = 4))
## [,1] [,2] [,3] [,4]
## [1,] 7 1 1 4
## [2,] 3 9 2 1
## [3,] 1 6 5 8
There is enough paint for 24 coats on the metal components, or rather, 8 single coated components and 8 double coated components That means there is enough room for 14 uncoated components for comparison. To minimize variance, we choose to test 8 uncoated components.