Supplementary Exercise 3.40 of IPS7e ------------------------------------ We first describe how to carry out the blocking and randomization using Table A in PSLS (or Table B in IPS), starting from line 125, say. To begin with, sort the subjects by (increasing) weight and divide them in blocks of four (see list below). Then WITHIN each block, select from Table A the digits 1-4 in random order. The first digit selected receives treatment A, the second treatment B, the third treatment C and the final treatment D (without selecting the digit). For example, the first three useable digits in line 125 are 4-1-2. This produces the treatment allocation shown below. See below for another way of using the digits in the table. name excw block treatment 1 Williams 22 1 B 2 Festinger 24 1 C 3 Hernandez 25 1 D 4 Moses 25 1 A 5 Santiago 27 2 A 6 Kendall 28 2 D 7 Mann 28 2 C 8 Smith 29 2 B 9 Brunk 30 3 C 10 Obrach 30 3 A 11 Rodriguez 30 3 B 12 Loren 32 3 D 13 Jackson 33 4 A 14 Stall 33 4 C 15 Brown 34 4 D 16 Dixon 34 4 B 17 Birnbaum 35 5 B 18 Tran 35 5 C 19 Nevesky 39 5 A 20 Wilansky 42 5 D Note: It would be equally valid to use Table A in a different way by letting the first digit 1-4 encountered correspond to the treatment for the first subject (1~A, 2~B, 3~C, 4~D), the second digit encountered correspond to the treatment for the second subject, and so on. For the first block this would give (starting from line 125): subject init weight block treatment 1 Williams 22 1 D 2 Festinger 24 1 A 3 Hernandez 25 1 B 4 Moses 25 1 C Next, we give Minitab commands and output: WOpen "R:\Chapter 3\ex03_040.mtw". Sort; By 'excw'; Original. Name c3 "block" Set 'block' 1( 1 : 5 / 1 )4 End. Three approaches are discussed. The first and simplest one splits the worksheet into separate worksheets for each block. Then the random assignment to treatments will take place in each worksheet, using methods for reordering values in a column. This approach is a bit clumsy, by giving us 5 new worksheets when we would probably be happy with a single one. The Minitab command for splitting worksheets is in the Data menu; further details are left for the interested student. The second method is similar but all operations are done within the a single worksheet (for simplicity, we will do this in a new worksheet, but it could also be done within the original worksheet). We need to "unstack" the column of (sorted) names by blocks to give us 5 columns of names (one for each block). Each of these 5 columns can then be reordered randomly, and afterwards the letters A, B, C and D can be assigned from top to bottom. Unstack ('name'); Subscripts 'block'; NewWS; VarNames. Base 140906. Sample 4 'name_1' 'name_1'. Sample 4 'name_2' 'name_2'. Sample 4 'name_3' 'name_3'. Sample 4 'name_4' 'name_4'. Sample 4 'name_5' 'name_5'. Name c9 "treatment" TSet 'treatment' 1( "A" "B" "C" "D" )1 End. Print 'name_1'-'treatment'. Data Display Row name_1 name_2 name_3 name_4 name_5 treatment 1 Williams Mann Loren Stall Wilansky A 2 Hernandez Santiago Brunk Brown Tran B 3 Festinger Smith Rodriguez Jackson Birnbaum C 4 Moses Kendall Obrach Dixon Nevesky D The third method version is simpler to carry out but perhaps more difficult to follow. We use a single column of random numbers to generate a random order of the subjects, and we achieve this random order WITHIN blocks by sorting by the random numbers within each block. Results for: ex03_040.mtw Base 140906. Name c4 "random" Random 20 'random'; Uniform 0.0 1.0. Sort; By 'block' 'random'; After. Name c9 "treatment" TSet 'treatment' 5( "A" "B" "C" "D" )1 End. Print 'name'-'treatment'. Data Display Sorted Sorted Sorted Row name excw block random Sorted name excw block random treatment 1 Williams 22 1 0.095396 Williams 22 1 0.095396 A 2 Festinger 24 1 0.711095 Moses 25 1 0.374238 B 3 Hernandez 25 1 0.837232 Festinger 24 1 0.711095 C 4 Moses 25 1 0.374238 Hernandez 25 1 0.837232 D 5 Santiago 27 2 0.599327 Smith 29 2 0.061293 A 6 Kendall 28 2 0.135048 Kendall 28 2 0.135048 B 7 Mann 28 2 0.433419 Mann 28 2 0.433419 C 8 Smith 29 2 0.061293 Santiago 27 2 0.599327 D 9 Brunk 30 3 0.845573 Obrach 30 3 0.080645 A 10 Obrach 30 3 0.080645 Rodriguez 30 3 0.207099 B 11 Rodriguez 30 3 0.207099 Brunk 30 3 0.845573 C 12 Loren 32 3 0.907534 Loren 32 3 0.907534 D 13 Jackson 33 4 0.453547 Brown 34 4 0.193934 A 14 Stall 33 4 0.855887 Jackson 33 4 0.453547 B 15 Brown 34 4 0.193934 Stall 33 4 0.855887 C 16 Dixon 34 4 0.989148 Dixon 34 4 0.989148 D 17 Birnbaum 35 5 0.849369 Nevesky 39 5 0.302916 A 18 Tran 35 5 0.457210 Tran 35 5 0.457210 B 19 Nevesky 39 5 0.302916 Birnbaum 35 5 0.849369 C 20 Wilansky 42 5 0.917628 Wilansky 42 5 0.917628 D