Examples


Example 55.1. A Split-Plot Design

This plan is appropriate for a split-plot design with main plots forming a randomized complete block design. In this example, there are three blocks, four main plots per block, and two subplots per main plot. First, three random permutations (one for each of the block s) of the integers 1, 2, 3, and 4 are produced. The four integers correspond to the four levels of the main plot factor a ; the permutation determines how the levels of a are assigned to the main plots within a block. For each of these twelve numbers (four numbers per block for three blocks), a random permutation of the integers 1 and 2 is produced. Each two-integer permutation determines the assignment of the two levels of the subplot factor b within a main plot. The following statements produce Output 55.1.1:

  title Split Plot Design;   proc plan seed=37277;   factors block=3 ordered a=4 b=2;   run;  
Output 55.1.1: A Split-Plot Design
start example
  Split Plot Design   The PLAN Procedure   Factor      Select      Levels     Order   block            3           3    Ordered   a                4           4    Random   b                2           2    Random   block        a      -b-   1        4      2 1   3      2 1   1      2 1   2      2 1   2        4      1 2   3      1 2   1      2 1   2      1 2   3        4      2 1   2      2 1   3      2 1   1      2 1  
end example
 

Example 55.2. A Hierarchical Design

In this example, three plants are nested within four pots, which are nested within three houses . The FACTORS statement requests a random permutation of the numbers 1, 2, and 3 to choose Houses randomly. The second step requests a random permutation of the numbers 1, 2, 3, and 4 for each of those first three numbers to randomly assign Pots to Houses . Finally, the FACTORS statement requests a random permutation of 1, 2, and 3 for each of the twelve integers in the second set of permutations. This last step randomly assigns Plants to Pots . The following statements produce Output 55.2.1:

  title 'Hierarchical Design';   proc plan seed=17431;   factors Houses=3 Pots=4 Plants=3 / noprint;   output out=nested;   run;   proc print data=nested;   run;  
Output 55.2.1: A Hierarchical Design
start example
  Hierarchical Design   Obs   Houses    Pots    Plants   1      1        3        2   2      1        3        3   3      1        3        1   4      1        1        3   5      1        1        1   6      1        1        2   7      1        2        2   8      1        2        3   9      1        2        1   10      1        4        3   11      1        4        2   12      1        4        1   13      2        4        1   14      2        4        3   15      2        4        2   16      2        2        2   17      2        2        1   18      2        2        3   19      2        3        2   20      2        3        3   21      2        3        1   22      2        1        2   23      2        1        3   24      2        1        1   25      3        4        1   26      3        4        3   27      3        4        2   28      3        1        3   29      3        1        2   30      3        1        1   31      3        2        1   32      3        2        2   33      3        2        3   34      3        3        3   35      3        3        2   36      3        3        1  
end example
 

Example 55.3. An Incomplete Block Design

Jarrett and Hall (1978) give an example of a generalized cyclic design with good efficiency characteristics. The design consists of two replicates of 52 treatments in 13 blocks of size 8. The following statements use the PLAN procedure to generate this design in an appropriately randomized form and store it in a SAS data set. Then, the TABULATE procedure is used to display the randomized plan. The following statements produce Output 55.3.1 and Output 55.3.2:

  title Generalized Cyclic Block Design;   proc plan seed=33373;   treatments trtmts=8 of 52 cyclic (1 2 3 4 32 43 46 49)4;   factors blocks=13 plots=8;   output out=c;   quit;   proc tabulate;   class blocks plots;   var trtmts;   table blocks, plots*(trtmts*f=8.) / rts=8;   run;  
Output 55.3.1: A Generalized Cyclic Block Design
start example
  Generalized Cyclic Block Design   The PLAN Procedure   Plot Factors   Factor      Select      Levels     Order   blocks          13          13    Random   plots            8           8    Random   Treatment Factors   Factor      Select      Levels     Order     Initial Block / Increment   trtmts           8          52    Cyclic     (1 2 3 4 32 43 46 49) / 4   blocks      -----plots-----      ---------trtmts--------   10      7 4 8 1 2 3 5 6       1  2  3  4 32 43 46 49   8      1 2 4 3 8 6 5 7       5  6  7  8 36 47 50  1   9      2 5 4 7 3 1 8 6       9 10 11 12 40 51  2  5   6      4 2 6 8 3 7 1 5      13 14 15 16 44  3  6  9   7      4 7 6 3 1 2 8 5      17 18 19 20 48  7 10 13   4      4 8 1 5 3 6 7 2      21 22 23 24 52 11 14 17   2      6 2 3 8 7 5 1 4      25 26 27 28  4 15 18 21   3      6 2 3 1 7 4 5 8      29 30 31 32  8 19 22 25   1      1 2 7 8 5 6 3 4      33 34 35 36 12 23 26 29   5      5 7 6 8 4 3 1 2      37 38 39 40 16 27 30 33   12      5 8 1 4 7 3 6 2      41 42 43 44 20 31 34 37   13      3 5 1 8 4 2 6 7      45 46 47 48 24 35 38 41   11      4 1 5 2 3 8 6 7      49 50 51 52 28 39 42 45  
end example
 
Output 55.3.2: A Generalized Cyclic Block Design
start example
  Generalized Cyclic Block Design   --------------------------------------------------------------------------------   plots   -----------------------------------------------------------------------   1       2       3       4       5       6       7       8   --------+--------+--------+--------+--------+--------+--------+--------   trtmts  trtmts  trtmts  trtmts  trtmts  trtmts  trtmts  trtmts   --------+--------+--------+--------+--------+--------+--------+--------   Sum     Sum     Sum     Sum     Sum     Sum     Sum     Sum   ------+--------+--------+--------+--------+--------+--------+--------+--------   blocks   ------   1           33      34      26      29      12      23      35      36   ------+--------+--------+--------+--------+--------+--------+--------+--------   2           18      26      27      21      15      25       4      28   ------+--------+--------+--------+--------+--------+--------+--------+--------   3           32      30      31      19      22      29       8      25   ------+--------+--------+--------+--------+--------+--------+--------+--------   4           23      17      52      21      24      11      14      22   ------+--------+--------+--------+--------+--------+--------+--------+--------   5           30      33      27      16      37      39      38      40   ------+--------+--------+--------+--------+--------+--------+--------+--------   6            6      14      44      13       9      15       3      16   ------+--------+--------+--------+--------+--------+--------+--------+--------   7           48       7      20      17      13      19      18      10   ------+--------+--------+--------+--------+--------+--------+--------+--------   8            5       6       8       7      50      47       1      36   ------+--------+--------+--------+--------+--------+--------+--------+--------   9           51       9      40      11      10       5      12       2   ------+--------+--------+--------+--------+--------+--------+--------+--------   10           4      32      43       2      46      49       1       3   ------+--------+--------+--------+--------+--------+--------+--------+--------   11          50      52      28      49      51      42      45      39   ------+--------+--------+--------+--------+--------+--------+--------+--------   12          43      37      31      44      41      34      20      42   ------+--------+--------+--------+--------+--------+--------+--------+--------   13          47      35      45      24      46      38      41      48   --------------------------------------------------------------------------------  
end example
 

Example 55.4. A Latin Square Design

All of the preceding examples involve designs with completely nested block structures, for which PROC PLAN was especially designed. However, by appropriate coordination of its facilities, a much wider class of designs can be accommodated. A Latin square design is based on experimental units that have a row-and-column block structure. The following example uses the CYCLIC option for a treatment factor tmts to generate a simple 4 — 4 Latin square. Randomizing a Latin square design involves randomly permuting the row, column, and treatment values independently. In order to do this, use the RANDOM option in the OUTPUT statement of PROC PLAN. The example also uses factor-value-settings in the OUTPUT statement. The following statements produce Output 55.4.1:

  title Latin Square Design;   proc plan seed=37430;   factors rows=4 ordered cols=4 ordered / noprint;   treatments tmts=4 cyclic;   output out=g   rows cvals=(Day 1 Day 2 Day 3 Day 4) random   cols cvals=(Lab 1 Lab 2 Lab 3 Lab 4) random   tmts nvals=(0      100     250     450) random;   quit;   proc tabulate;   class rows cols;   var tmts;   table rows, cols*(tmts*f=6.) / rts=8;   run;  
Output 55.4.1: A Randomized Latin Square Design
start example
  Latin Square Design   ------------------------------------   cols   ---------------------------   Lab 1 Lab 2 Lab 3 Lab 4   ------+------+------+------   tmts  tmts  tmts  tmts   ------+------+------+------   Sum  Sum  Sum  Sum   ------+------+------+------+------   rows   ------   Day 1      0   250   100   450   ------+------+------+------+------   Day 2    250   450     0   100   ------+------+------+------+------   Day 3    100     0   450   250   ------+------+------+------+------   Day 4    450   100   250     0   ------------------------------------  
end example
 

Example 55.5. A Generalized Cyclic Incomplete Block Design

The following statements depict how to create an appropriately randomized generalized cyclic incomplete block design for v treatments (given by the value of t ) in b blocks (given by the value of b ) of size k (with values of p indexing the cells within a block) with initial block ( e 1 e 2 ... e k ) and increment number i .

  factors b=   b   p=   k   ;   treatments t=   k   of   v   cyclic (   e   1   e   2  ...  e    k    )   i   ;  

For example, the specification

  proc plan seed=37430;   factors b=10 p=4;   treatments t=4 of 30 cyclic (1 3 4 26) 2;   run;  

generates the generalized cyclic incomplete block design given in Example 1 of Jarrett and Hall (1978), which is given by the rows and columns of the plan associated with the treatment factor t in Output 55.5.1.

Output 55.5.1: A Generalized Cyclic Incomplete Block Design
start example
  The PLAN Procedure   Plot Factors   Factor      Select      Levels     Order   b               10          10    Random   p                4           4    Random   Treatment Factors   Initial Block   Factor      Select      Levels     Order     / Increment   t                4          30    Cyclic     (1 3 4 26) / 2   b      ---p---      -----t-----   2      2 3 1 4       1  3  4 26   1      3 2 4 1       3  5  6 28   3      2 3 4 1       5  7  8 30   10      4 2 3 1       7  9 10  2   9      4 1 2 3       9 11 12  4   4      1 3 2 4      11 13 14  6   5      1 2 4 3      13 15 16  8   8      3 2 4 1      15 17 18 10   7      2 4 1 3      17 19 20 12   6      2 1 4 3      19 21 22 14  
end example
 

Example 55.6. Permutations and Combinations

Occasionally, you may need to generate all possible permutations of n things, or all possible combinations of n things taken m at a time.

For example, suppose you are planning an experiment in cognitive psychology where you want to present four successive stimuli to each subject. You want to observe each permutation of the four stimuli. The following statements use PROC PLAN to create a data set containing all possible permutations of 4 numbers in random order.

  title All Permutations of 1,2,3,4;   proc plan seed=60359;   factors    Subject  = 24 6+   Order    = 4  ordered;   treatments Stimulus = 4  perm;   output out=Psych;   proc sort data=Psych out=Psych;   by Subject Order;   proc tabulate formchar=            noseps;   class Subject Order;   var Stimulus;   table Subject, Order*(Stimulus*f=8.)*sum=  / rts=9;   run;  

The variable Subject is set at 24 levels because there are 4! = 24 total permutations to be listed. If Subject > 24, the list repeats. Output 55.6.1 and Output 55.6.2 display the PROC PLAN output. Note that the variable Subject is listed in random order.

Output 55.6.1: List of Permutations
start example
  All Permutations of 1,2,3,4   The PLAN Procedure   Plot Factors   Factor       Select      Levels     Order   Subject          24          24    Random   Order             4           4    Ordered   Treatment Factors   Factor        Select      Levels     Order   Stimulus           4           4    Perm  
end example
 
Output 55.6.2: List of Permutations
start example
  All Permutations of 1,2,3,4   The PLAN Procedure   Subject     -Order-      -Stimulus-   4     1 2 3 4      1  2  3  4   15     1 2 3 4      1  2  4  3   24     1 2 3 4      1  3  2  4   1     1 2 3 4      1  3  4  2   5     1 2 3 4      1  4  2  3   17     1 2 3 4      1  4  3  2   19     1 2 3 4      2  1  3  4   14     1 2 3 4      2  1  4  3   6     1 2 3 4      2  3  1  4   23     1 2 3 4      2  3  4  1   8     1 2 3 4      2  4  1  3   2     1 2 3 4      2  4  3  1   13     1 2 3 4      3  1  2  4   16     1 2 3 4      3  1  4  2   12     1 2 3 4      3  2  1  4   18     1 2 3 4      3  2  4  1   21     1 2 3 4      3  4  1  2   9     1 2 3 4      3  4  2  1   22     1 2 3 4      4  1  2  3   10     1 2 3 4      4  1  3  2   7     1 2 3 4      4  2  1  3   11     1 2 3 4      4  2  3  1   3     1 2 3 4      4  3  1  2   20     1 2 3 4      4  3  2  1  
end example
 

The output data set Psych contains 96 observations of the 3 variables ( Subject , Order , and Stimulus ). Sorting the output data set by Subject and by Order within Subject results in all possible permutations of Stimulus in random order. PROC TABULATE displays these permutations in Output 55.6.3.

Output 55.6.3: Randomized Permutations
start example
  All Permutations of 1,2,3,4   Order   1        2        3        4   Stimulus Stimulus Stimulus Stimulus   Subject   1              1        3        4        2   2              2        4        3        1   3              4        3        1        2   4              1        2        3        4   5              1        4        2        3   6              2        3        1        4   7              4        2        1        3   8              2        4        1        3   9              3        4        2        1   10             4        1        3        2   11             4        2        3        1   12             3        2        1        4   13             3        1        2        4   14             2        1        4        3   15             1        2        4        3   16             3        1        4        2   17             1        4        3        2   18             3        2        4        1   19             2        1        3        4   20             4        3        2        1   21             3        4        1        2   22             4        1        2        3   23             2        3        4        1   24             1        3        2        4  
end example
 

As another example, suppose you have six alternative treatments, any four of which can occur together in a block (in no particular order). The following statements use PROC PLAN to create a data set containing all possible combinations of six numbers taken four at a time. In this case, you use ODS to create the data set.

  title All Combinations of (6 Choose 4) Integers;   ods output Plan=Combinations;   proc plan;   factors Block=15 ordered   Treat= 4 of 6 comb;   run;   proc print data=Combinations noobs;   run;  

The variable Block has 15 levels since there are a total of 6! / (4!2!) = 15 combinations of four integers chosen from six integers. The data set formed by ODS from the displayed plan has one row for each block, with the four values of Treat corresponding to four different variables, as shown in Output 55.6.4.

Output 55.6.4: List of Combinations
start example
  All Combinations of (6 Choose 4) Integers   The PLAN Procedure   Factor      Select      Levels     Order   Block           15          15    Ordered   Treat            4           6    Comb   Block      -Treat-   1      1 2 3 4   2      1 2 3 5   3      1 2 3 6   4      1 2 4 5   5      1 2 4 6   6      1 2 5 6   7      1 3 4 5   8      1 3 4 6   9      1 3 5 6   10      1 4 5 6   11      2 3 4 5   12      2 3 4 6   13      2 3 5 6   14      2 4 5 6   15      3 4 5 6  
end example
 
Output 55.6.5: Combinations Data Set Created by ODS
start example
  All Combinations of (6 Choose 4) Integers   Block    Treat1    Treat2    Treat3    Treat4   1      1         2         3         4   2      1         2         3         5   3      1         2         3         6   4      1         2         4         5   5      1         2         4         6   6      1         2         5         6   7      1         3         4         5   8      1         3         4         6   9      1         3         5         6   10      1         4         5         6   11      2         3         4         5   12      2         3         4         6   13      2         3         5         6   14      2         4         5         6   15      3         4         5         6  
end example
 



SAS.STAT 9.1 Users Guide (Vol. 5)
SAS.STAT 9.1 Users Guide (Vol. 5)
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 98

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net