# The LATTICE Procedure

## Getting Started: LATTICE Procedure

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 68.1.

Figure 68.1: Output from Example LATTICE Procedure

 Examining the Growth Rate of Pigs

The Lattice Procedure

Analysis of Variance for Weight
Source DF Sum of Squares Mean Square
Replications 3 0.07739 0.02580
Blocks within Replications (Adj.) 8 1.4206 0.1776
Component B 8 1.4206 0.1776
Intra Block Error 16 1.2368 0.07730
Randomized Complete Block Error 24 2.6574 0.1107
Total 35 5.9609 0.1703

Variance of Means in Same Block 0.04593
LSD at .01 Level 0.6259
LSD at .05 Level 0.4543
Efficiency Relative to RCBD 120.55

Means for Weight
Treatment Mean
1 1.8035
2 1.7544
3 1.9643
4 1.7267
5 0.9393
6 1.8448
7 1.3870
8 1.4347
9 1.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.