The FACTEX Procedure


Example 7.10 Hyper-Graeco-Latin Square Design

Note: See Hyper-Graeco-Latin Square in the SAS/QC Sample Library.

A $q\times q$ Latin square is an arrangement of q symbols, each repeated q times, in a square of side q such that each symbol appears exactly once in each row and in each column. Such arrangements are useful as designs for row-and-column experiments, where it is necessary to balance the effects of two q-level factors simultaneously.

A Graeco-Latin square is actually a pair of Latin squares; when superimposed, each symbol in one square occurs exactly once with each symbol in the other square. The following is an example of a $5\times 5$ Graeco-Latin square, where Latin letters are used for the symbols of one square and Greek letters are used for the symbols of the other:

\[ \begin{array}{ccccc} A\alpha &  B\beta &  C\gamma &  D\delta &  E\epsilon \\ B\gamma &  C\delta &  D\epsilon &  E\alpha &  A\beta \\ C\epsilon &  D\alpha &  E\beta &  A\gamma &  B\delta \\ D\beta &  E\gamma &  A\delta &  B\epsilon &  C\alpha \\ E\delta &  A\epsilon &  B\alpha &  C\beta &  D\gamma \end{array} \]

Whenever q is a power of a prime number, you can construct up to q – 1 squares, each with q symbols that are balanced over all the other factors. The result is called a hyper-Graeco-Latin square or a complete set of mutually orthogonal Latin squares. Such arrangements can be useful as designs (refer to Williams 1949), or they can be used to construct other designs.

When q is a prime power, hyper-Graeco-Latin squares are straightforward to construct with the FACTEX procedure. This is because a complete set of q – 1 mutually orthogonal $q\times q$ Latin squares is equivalent to a resolution 3 design for q + 1 q-level factors in $q^{2}$ runs, where two of the factors index rows and columns and each of the remaining factors indexes the treatments of one of the squares.

For example, the following statements generate a complete set of three mutually orthogonal $4\times 4$ Latin squares, with rows indexed by the factor Row, columns indexed by the factor Column, and the treatment factors in the respective squares indexed by t1, t2, and t3. The first step is to construct a resolution 3 design for five 4-level factors in 16 runs.

proc factex;
   factors Row Column t1-t3 / nlev=4;
   size design=16;
   model resolution=3;
   output out=OrthArray t1 cvals=('A' 'B' 'C' 'D')
                        t2 cvals=('A' 'B' 'C' 'D')
                        t3 cvals=('A' 'B' 'C' 'D');
run;
data _null_;
   array t{3} $ t1-t3;
   array s{4} $ s1-s4; /* Buffer for holding each row      */
   file print;         /* Direct printing to output screen */
   do square=1 to 3;
      put "Square " square ":";
      n = 1;
      do r=1 to 4;
         do c=1 to 4;
            set OrthArray point=n; n=n+1;
            s{c}=t{square};
         end;
         put "       " s1-s4;
      end;
      put;
   end;
   stop;
run;

In most cases, the form that appears in the output data set OrthArray is most useful. The form that usually appears in textbooks is displayed in Output 7.10.1, which can be produced by using a simple DATA step (not shown here).

Output 7.10.1: Hyper-Graeco-Latin Square

Square 1 :                                                                  
       A D B C                                                              
       D A C B                                                              
       B C A D                                                              
       C B D A                                                              

Square 2 :                                                                  
       A D B C                                                              
       C B D A                                                              
       D A C B                                                              
       B C A D                                                              

Square 3 :                                                                  
       A D B C                                                              
       B C A D                                                              
       C B D A                                                              
       D A C B