Chapter Contents Previous Next
 Details of the FACTEX Procedure

## Example 15.13: Incomplete Block Design

 See FACTEX7B in the SAS/QC Sample Library

Several important series of balanced incomplete block designs can be derived from orthogonal factorial designs. One is the series on balanced lattice of Yates (1936); refer to page 396 of Cochran and Cox (1957). In this situation, the number of treatments v must be the square of a power of a prime number: v = q2,    q = pk where p is a prime number. These designs are based on a complete set of q-1 mutually orthogonal q×q Latin squares, which is equivalent to a resolution 3 design for q+1 q-level factors in q2 runs.

The balanced lattice designs include q+1 replicates of the treatments. They are constructed by associating each treatment with a run in the factorial design, each replicate with one of the factors, and each block with one of the q values of that factor. For example, the treatments in Block 3 within Replicate 2 are those treatments that are associated with runs for which factor 2 is set at value 3. The following statements use this method to construct a balanced lattice design for 16 treatments in five replicates of four blocks each. The construction procedure is based on a resolution 3 design for five four-level factors in 16 runs.

```   proc factex;
factors x1-x5 / nlev=4;
size design=16;
model r=3;
output out=a;
run;
```

In the following DATA step, the incomplete block design is built using the design saved in the data set A by the FACTEX procedure:

```   data b;
keep rep block plot t;
array x{5} x1-x5;
do rep = 1 to 5;
do block = 1 to 4;
plot = 0;
do n = 1 to 16;
set a point=n;
if (x{rep}=block-1) then do;
t = n;
plot = plot + 1;
output;
end;
end;
end;
end;
stop;
run;
```

For each block within each replicate, the program loops through the run numbers in the factorial design and chooses those which have the REPth factor equal to BLOCK-1. These run numbers are the treatments that go into the particular block.

The design is printed using a DATA step. Each block of each replicate is built into the variables S1, S2, S3, and S4, and each block is printed with a PUT statement.

```  data _null_;
array s{4} s1-s4;            /* Buffer for holding each block    */
file print;                  /* Direct printing to output screen */
n = 1;
do r = 1 to 5;
put "Replication " r 1.0 ":";
do b = 1 to 4;
do p = 1 to 4;
set b point=n;
s{plot} = t;
n = n+1;
end;
put "    Block " b 1.0 ":" (s1-s4) (3.0);
end;
put;
end;
stop;
run;
```
The design is displayed in Output 15.13.1.

You can use the PLAN procedure to randomize the block design, as shown by the following statements:

```   proc plan seed=54321;
factors rep=5 block=4 plot=4;
output data=b out=c;

proc sort;
by rep block plot;
run;
```

The variable PLOT indexes the plots within each block. Refer to the SAS/STAT User's Guide for a general discussion of randomizing block designs.

Finally, substitute `set c` for `set b` in the preceding DATA step. Running this DATA step creates the randomized design displayed in Output 15.13.2.

Output 15.13.1: A Balanced Lattice
 ``` Replication 1: Block 1: 1 2 3 4 Block 2: 5 6 7 8 Block 3: 9 10 11 12 Block 4: 13 14 15 16 Replication 2: Block 1: 1 5 9 13 Block 2: 2 6 10 14 Block 3: 3 7 11 15 Block 4: 4 8 12 16 Replication 3: Block 1: 1 6 11 16 Block 2: 3 8 9 14 Block 3: 4 7 10 13 Block 4: 2 5 12 15 Replication 4: Block 1: 1 8 10 15 Block 2: 3 6 12 13 Block 3: 4 5 11 14 Block 4: 2 7 9 16 Replication 5: Block 1: 1 7 12 14 Block 2: 3 5 10 16 Block 3: 4 6 9 15 Block 4: 2 8 11 13 ```

Output 15.13.2: Randomized Design
 ``` Replication 1: Block 1: 15 5 2 12 Block 2: 3 8 9 14 Block 3: 16 1 11 6 Block 4: 7 10 13 4 Replication 2: Block 1: 2 4 3 1 Block 2: 5 7 8 6 Block 3: 9 11 10 12 Block 4: 15 16 13 14 Replication 3: Block 1: 2 13 8 11 Block 2: 14 12 7 1 Block 3: 15 4 9 6 Block 4: 5 16 3 10 Replication 4: Block 1: 13 1 5 9 Block 2: 14 2 10 6 Block 3: 11 15 3 7 Block 4: 16 12 4 8 Replication 5: Block 1: 2 16 7 9 Block 2: 15 10 8 1 Block 3: 3 12 6 13 Block 4: 5 11 14 4 ```

 Chapter Contents Previous Next Top