The LATTICE Procedure

Getting Started: LATTICE Procedure

(View the complete code for this example.)

An example of a balanced square design is an experiment to investigate the effects of nine diets on the growth rate of pigs.

In some breeds of pigs, past experience has shown that a large part of the total variation in growth rates between animals can be attributed to the litter. Therefore, this experiment is planned so that litter differences do not contribute to the intrablock error.

First, the pigs are separated into sets of three litter-mates. Each block is assigned two sets of the three litter-mates. In a given block, one pig from each set receives a diet. Therefore, the experimental unit is a pair of pigs feeding in a particular pen on one of the nine diets. The response variable, growth rate, is the sum of the growth rates for the two pigs in a particular pen. To get the adjusted diet mean per pig, the adjusted treatment mean for the pen must be divided by 2.

The special numeric SAS variables named Group, Block, Treatment, and Rep must be used to define the design. In this example, the Treatment variable ranges from 1 to 9 and indicates the particular diet. The Block variable is 1, 2, or 3 and indicates the pen containing the two pigs. The Group variable ranges from 1 to 4 and specifies which replication within the basic plan includes the experimental unit. In this example, you would not use the Rep variable since the entire basic plan is not replicated.

You can use the following DATA step and PROC LATTICE statement to analyze this experiment. The response variable is Weight.

title 'Examining the Growth Rate of Pigs';

data Pigs;
   input Group Block Treatment Weight @@;
   datalines;
1 1 1 2.20  1 1 2 1.84  1 1 3 2.18  1 2 4 2.05  1 2 5 0.85
1 2 6 1.86  1 3 7 0.73  1 3 8 1.60  1 3 9 1.76
2 1 1 1.19  2 1 4 1.20  2 1 7 1.15  2 2 2 2.26  2 2 5 1.07
2 2 8 1.45  2 3 3 2.12  2 3 6 2.03  2 3 9 1.63
3 1 1 1.81  3 1 5 1.16  3 1 9 1.11  3 2 2 1.76  3 2 6 2.16
3 2 7 1.80  3 3 3 1.71  3 3 4 1.57  3 3 8 1.13
4 1 1 1.77  4 1 6 1.57  4 1 8 1.43  4 2 2 1.50  4 2 4 1.60
4 2 9 1.42  4 3 3 2.04  4 3 5 0.93  4 3 7 1.78
;
proc lattice data=Pigs;
   var Weight;
run;

The SAS code produces the output shown in Figure 1.

Figure 1: Output from Example LATTICE Procedure

Examining the Growth Rate of Pigs

The Lattice Procedure

Analysis of Variance for Weight
SourceDFSum of SquaresMean Square
Replications30.077390.02580
Blocks within Replications (Adj.)81.42060.1776
Component B81.42060.1776
Treatments (Unadj.)83.22610.4033
Intra Block Error161.23680.07730
Randomized Complete Block Error242.65740.1107
Total355.96090.1703

Additional Statistics for Weight
Variance of Means in Same Block0.04593
LSD at .01 Level0.6259
LSD at .05 Level0.4543
Efficiency Relative to RCBD120.55

Adjusted Treatment
Means for Weight
TreatmentMean
11.8035
21.7544
31.9643
41.7267
50.9393
61.8448
71.3870
81.4347
91.5004


Diet 3 yields the highest mean growth rate at 1.9643 pounds for the two pigs (0.9822 per pig), while diet 5 has the lowest rate at 0.9393 (0.4696 per pig). The efficiency of the experiment relative to a randomized complete block design is 120.55 percent, so using the lattice design increased precision, producing more accurate estimates of the treatment effects. The different elements of the LATTICE procedure’s output are discussed in the Displayed Output section.

Last updated: October 28, 2020