SAS.STAT 9.1 Users Guide (Vol. 5)

Three Replications with Four Factors

Suppose you want to determine if the order in which four drugs are given affects the response of a subject. If you have only three subjects to test, you can use the following statements to design the experiment.

proc plan seed=27371; factors Replicate=3 ordered Drug=4; run;

These statements produce a design with three replicates of the four levels of the factor Drug arranged in random order. The three levels of Replicate are arranged in order, as shown in Figure 55.1

The PLAN Procedure Factor Select Levels Order Replicate 3 3 Ordered Drug 4 4 Random Replicate --Drug- 1 3 2 4 1 2 1 2 4 3 3 4 1 2 3

Figure 55.1: Three Replications and Four Factors

You may also want to apply one of four different treatments to each cell of this plan (for example, applying different amounts of each drug). The following statements create the output shown in Figure 55.2

factors Replicate=3 ordered Drug=4; treatments Treatment=4; run;

The PLAN Procedure Plot Factors Factor Select Levels Order Replicate 3 3 Ordered Drug 4 4 Random Treatment Factors Factor Select Levels Order Treatment 4 4 Random Replicate --Drug- --Treatment-- 1 3 1 2 4 2 1 3 4 2 4 3 2 1 4 1 2 3 3 3 2 4 1 1 4 2 3

Figure 55.2: Using the TREATMENTS Statement

Randomly Assigning Subjects to Treatments

You can use the PLAN procedure to design a completely randomized design. Suppose you have 12 experimental units, and want to assign one of two treatments to each unit. Use a DATA step to store the unrandomized design in a SAS data set, then call PROC PLAN to randomize it by specifying one RANDOM factor of 12 levels. The following statements produce Figure 55.3 and Figure 55.4:

Completely Randomized Design The PLAN Procedure Factor Select Levels Order unit 12 12 Random ----------------unit--------------- 8 5 1 4 6 2 12 7 3 9 10 11

Figure 55.3: A Completely Randomized Design for Two Treatments

Completely Randomized Design Obs unit treat 1 1 1 2 2 1 3 3 2 4 4 1 5 5 1 6 6 1 7 7 2 8 8 1 9 9 2 10 10 2 11 11 2 12 12 2

Figure 55.4: A Completely Randomized Design for Two Treatments

title Completely Randomized Design; /* The unrandomized design */ data a; do unit=1 to 12; if (unit <= 6) then treat=1; else treat=2; output; end; run; /* Randomize the design */ proc plan seed=27371; factors unit=12; output data=a out=b; run; proc sort data=b; by unit; proc print; run;

Figure 55.3 shows that the 12 levels of the unit factor have been randomly reordered and then lists the new ordering.

After the data is sorted by the unit variable, the randomized design is displayed in Figure 55.4.

You can also generate the plan by using a TREATMENTS statement instead of a DATA step. The following statements generate the same plan.

proc plan seed=27371; factors unit=12; treatments treat=12 cyclic (1 1 1 1 1 1 2 2 2 2 2 2); output out=b; run;

Категории