Skip to Main Content

SAS Library Slicing Interactions in SAS


This page was adapted from a page created by Oliver Schabenberger.  We thank
Professor Schabenberger for permission to adapt and distribute this page via our web site.


 

Introduction
Physical Slicing

Slicing
without separating the data

        Slicing in PROC MIXED vs. GLM

Comparing cell
means in the presence of significant interactions

       In PROC GLM
       In PROC MIXED (preferred)

Slicing three-way and
higher order interactions


Introduction

In factorial experiments significant
interactions are perceived as a real problem. Some analysts feel that the significance of
an interaction is detrimental to interpretation of the results. These fears are unfounded.
A problem in the past has been that little guidance and tools were available to proceed
with post-ANOVA procedures in the presence of significant interactions. This has
dramatically changed with recent implementations in The SAS System. The purpose of this
page is to introduce the interested reader to the technique of slicing, the
interpretation of effect slices and appropriate post-ANOVA procedures in light of
significant interactions. Among statisticians the term slicing is not common. It is
actually derived from SAS parlance. The correct terms for the procedure are simple
effects
or simple main effects.

If factors A and B interact one interpretation
is as a lack of additivity. This stems from the linear model representation of the
factorial treatment and design structure. If two factors act independently on the outcome
of an experiment, their contributions are additive. A makes its contribution independent
of B and you can add the two up to assess their joint effect. If an interaction between A
and B is present this additivity no longer applies. You have to know the particular level
of B to assess the effects of A and vice versa. An alternative interpretation is

Comparisons among the levels of A depend on
the level of B they are performed at;

Comparisons among the levels of B depend on the
level of A they are performed at.

If, for example, A refers to different locations
and B to a treatment factor, their interaction implies that there may be differences among
the B levels (= a treatment effect) at some locations, while a treatment effect is absent
at others. Consequently, one should look at the treatment comparisons separately by
location.

Physical
slicing

A physical slice implies breaking the data set
into separate parts. If there are three locations (factor A) and four treatment levels
(factor B) you separate the data into three different sets and run one-way ANOVAs for each
location. In SAS this is done easily with by-processing, e.g.,

 

data exper1;
  input block location treat y;
  datalines;
<data goes here>
;
run;
proc sort data=exper1; by location; run;
proc glm data=exper1;
  class block treat;
  model y = block treat;
  by location;
run;

What are the disadvantages of physical
slicing?

1. The power of an ANOVA F-test is a function of
the error degrees of freedom, i.e., the amount of information used to estimate the error
mean square. By physically slicing by locations, each analysis contributes only 1/3 of the
total information (if there are three locations). The error degrees of freedom will be
dramatically reduced and the individual analyses are more powerless as the combined
analysis in which the interaction was detected.

2. physically slicing is a lot of work. You have to
run many individual analyses which then need to be combined somehow for a meaningful joint
interpretation

Slicing without separating the data

The technique we are aiming for does not
separate the data but generates the appropriate tests in one analysis. Detection of the
significant interaction and its slicing is all done in a single step. This is actually
very easy with the newer releases of The SAS System (Version 6.11 and later releases).

Example: An experiment was conducted to assess
electrolyte leakage from four different tissue types upon freezing. The experiment was a
completely randomized design with a two-factor treatment structure. factor Temperature has
eight levels, factor Tssue Type has four levels. The next table shows the two-way (cell)
means:

 

————————————–
|        |
Tissue Type
|

|        |---------------------------|
|        |  1   |  2
|  3   |  4   |

|--------+------+------+------+------|
|Tempera-|      |      |
|      |

|ture    |      |
|      |
|

|--------|      |      |
|      |

|-8      |  96.8|  81.5|  61.8|  98.3|

|--------+------+------+------+------|
|-7      |  87.0|  58.6|  43.6|  96.7|

|--------+------+------+------+------|
|-6      |  72.6|  51.7|  33.6|  89.5|

|--------+------+------+------+------|
|-5      |  51.5|  33.7|  25.0|  75.4|

|--------+------+------+------+------|
|-4      |  36.6|  25.5|  15.9|  64.4|

|--------+------+------+------+------|
|-3      |  23.9|   7.4|  14.7|
17.1|

|--------+------+------+------+------|
|-2      |  17.0|   7.2|  11.8|
15.7|

|--------+------+------+------+------|
|0       |   4.6|   3.5|
6.5|   4.1|

--------------------------------------

With decreasing temperatures leakage increases
for any tissue type. The increments are not the same, however.

 

Plot of LEAK*TEMP.  Symbol is value of
TISSUE.

      
   100

4

4      1

4      1

2
    75

4      1
 L    
 e

4

3
 a

2
 k  50

1      2
 a

3
 g

1
 e

2      3
    25

1      2     3

1
4     3


3
3

         1
2     2

     0
      

-----------------------------------------------------

          0    -1
-2    -3    -4    -5
-6    -7    -8


Temperature

NOTE: 4 obs hidden.

With decreasing temperature leakage separates
more and more among the tissue types. There appears to be an interaction between
temperature and tissue types: a comparison of tissue types depends on what temperature it
is performed at. At -2 degrees, the tissue types may not be significantly different, at -7
degrees they may.

To verify whether there is an interaction, run a
two-way ANOVA

 

proc glm data=leakage;
  class tissue temp;
  model leak = tissue temp tissue*temp;
run; quit;

with abridged output:

 

General Linear Models Procedure

Class Level Information
Class    Levels    Values
TISSUE        4    1 2 3 4
TEMP          8    0 -2 -3
-4 -5 -6 -7 -8

Number of observations in data set = 160

Source   DF     Sum of Squares
Mean Square   F Value
Pr > F

Model    31     158585.4375175
5115.6592748     48.70
0.0001

Error   128      13444.5222800
105.0353303

Total   159     172029.9597975

Source      DF
Type III SS        Mean Square   F Value
Pr > F

TISSUE       3
23847.0616725      7949.0205575
75.68     0.0001

TEMP         7
121221.3735775     17317.3390825
164.87     0.0001

TISSUE*TEMP 21      13517.0022675
643.6667746      6.13
0.0001

The interaction is significant at all reasonable
Type-I error levels. To compare the tissue types separately for each temperature, slice
the interaction by temperatures:

 

proc glm data=leakage;
  class tissue temp;
  model leak = tissue temp tissue*temp;
  lsmeans tissue*temp / slice=temp;
run;

The additional output table this produces is:

 

TISSUE*TEMP Effect Sliced by TEMP for LEAK


Sum of            Mean

TEMP     DF        Squares
Square
F Value     Pr > F

 0        3
25.533695
8.511232
0.0810     0.9702

-2        3
288.976095         96.325365
0.9171     0.4347

-3        3
696.837335
232.279112       2.2114      0.0899

-4        3
6589.763440      2196.587813
20.9128     0.0001

-5        3
7427.236375      2475.745458
23.5706     0.0001

-6        3
8898.054000      2966.018000
28.2383     0.0001

-7        3
9107.437500      3035.812500
28.9028     0.0001

-8        3
4330.225500      1443.408500
13.7421     0.0001

Each row of this table corresponds to a
comparison of tissue types at a certain temperature. At 0 degrees, there is no difference
of the tissue types (P=0.9702). At -2 degrees centigrade the p-value has dropped tp
0.4347, but not sufficiently to declare significance. Continuing, one finds that at th 5%
significance level at -4 degrees centigrade the tissue types first show significantly
different electrolyte leakage.

It is important to note that these analyses are
based on a total of 128 error degrees of freedom and a error mean square estimate of
105.03. This is the error from the overall analysis. For example the F statistic for
testing tissue effects at -3 degrees is 232.279/105.03 = 2.2114.

If you perform separate analyses by
temperatures;

 

proc sort data=leakage; by temp; run;
proc glm data=leakage;
  class tissue;
  model leak = tissue;
  by temp;
run; quit;

and list the sum of squares for tissue effects,
you get

 

Temp   Source      DF
Type I SS
 0     TISSUE       3
25.53369500

-2     TISSUE       3
288.97609500

-3     TISSUE       3
696.83733500

-4     TISSUE       3
6589.76344000

-5     TISSUE       3
7427.23637500

-6     TISSUE       3
8898.05400000

-7     TISSUE       3
9107.43750000

-8     TISSUE       3
4330.22550000

Notice that the sum of squares for the separate
tissue main effects are identical to the slice sum of squares.

Slicing in PROC MIXED

You can slice interactions in PROC GLM or PROC
MIXED (which I prefer). The output produced by the SLICE option of PROC MIXED differs
slightly from that of PROC GLM. The statements

 

proc mixed data=leakage;
  class tissue temp;
  model leak = tissue temp tissue*temp;
  lsmeans tissue*temp / slice=temp;
run;

produce the Table of Effect Slices:

 

Tests of Effect Slices

Effect       TEMP   NDF   DDF
F  Pr > F

TISSUE*TEMP   0       3   128
0.08  0.9702

TISSUE*TEMP  -2       3   128
0.92  0.4347

TISSUE*TEMP  -3       3   128
2.21  0.0899

TISSUE*TEMP  -4       3   128
20.91  0.0001

TISSUE*TEMP  -5       3   128
23.57  0.0001

TISSUE*TEMP  -6       3   128
28.24  0.0001

TISSUE*TEMP  -7       3   128
28.90  0.0001

TISSUE*TEMP  -8       3   128
13.74  0.0001

The first column refers to the effect being
sliced. The second column to the level at which a comparison is being performed. The
second row, for example, refers to a comparison at -2 degree centigrade. Since the Effect
being sliced is TISSUE*TEMP the levels being compared are the four tissue types. This is
also obvious from the NDF (=numerator degrees of freedom) column (four tissue types – 1 =
3 ndf). Notice that the F- and p-values are identical to those from PROC GLM.

PROC MIXED has one definite advantage over PROC
GLM. Its LSMEANS statement permits the very powerful DIFF option. More on this in the next
section.

Comparing
Cell Means in the Presence of Significant Interactions

If a main effect is significant and not masked
by an interaction, we usually proceed with post-ANOVA procedures, comparing marginal
means in pairs (either all pairs or all means against a control or some such thing). If
interactions are significant, cell means should be compared instead, since the
marginal means may not properly represent the treatment differences at the various levels
of a factor. Looking at the table of effect slices from the leakage example,

 

Effect       TEMP   NDF   DDF
F  Pr > F

TISSUE*TEMP   0       3   128
0.08  0.9702

TISSUE*TEMP  -2       3   128
0.92  0.4347

TISSUE*TEMP  -3       3   128
2.21  0.0899

TISSUE*TEMP  -4       3   128
20.91  0.0001

TISSUE*TEMP  -5       3   128
23.57  0.0001

TISSUE*TEMP  -6       3   128
28.24  0.0001

TISSUE*TEMP  -7       3   128
28.90  0.0001

TISSUE*TEMP  -8       3   128
13.74  0.0001

one would concentrate on
comparing the cell means for temperatures below -4 degrees centigrade, since there appear
to be no differences (at the 5% level) for higher temperatures.

Cell means are reasonably compared only as simple
effects
. A simple effect is a comparison in which all but one factor are fixed at a
certain level. For example a comparison like
Temp(-2),Tissue(1)
versus Temp(-5),Tissue(4)
is not really
meaningful since both factors are varied. Valid simple effects in this example could be

Temp(-2),Tissue(1) versus Temp(-2),Tissue(4)
Temp(-3),Tissue(1) versus Temp(-5),Tissue(1).

In PROC GLM you can
request these comparisons with the PDIFF option of the LSMEANS statement. The MEANS
statement which is used for main effects multiple comparisons will not work for
interactions (rightfully so).

For example,

 

proc glm data=leakage;
  class tissue temp;
  model leak = tissue temp tissue*temp;
  lsmeans tissue*temp / pdiff;
run;

The output produced in addition to the regular ANOVA table is as follows:

 

General Linear Models Procedure
Least Squares Means

TISSUE   TEMP          LEAK
LSMEAN


LSMEAN    Number

1         0
4.6320000     1

1        -2
17.0000000     2

1        -3
23.8800000     3

1        -4
36.6480000     4

1        -5
51.4500000     5

1        -6
72.6000000     6

1        -7
86.9600000     7

1        -8
96.8000000     8

2         0
3.4780000     9

2        -2
7.2280000    10

2        -3
7.3540000    11

2        -4
25.4800000    12

2        -5
33.7000000    13

2        -6
51.7200000    14

2        -7
58.6200000    15

2        -8
81.4600000    16

3         0
6.5080000    17

3        -2
11.8400000    18

3        -3
14.7400000    19

3        -4
15.9200000    20

3        -5
24.9800000    21

3        -6
33.6400000    22

3        -7
43.5800000    23

3        -8
61.7800000    24

4         0
4.1160000    25

4        -2
15.6740000    26

4        -3
17.0760000    27

4        -4
64.3600000    28

4        -5
75.3800000    29

4        -6
89.5200000    30

4        -7
96.7400000    31

4        -8
98.2600000    32

Pr > |T| H0: LSMEAN(i)=LSMEAN(j)

   i/j     1       2
3       4
5       6
7       8

   1   .      0.0586  0.0036
0.0001  0.0001  0.0001  0.0001  0.0001

   2  0.0586   .      0.2905
0.0029  0.0001  0.0001  0.0001  0.0001

   3  0.0036  0.2905   .
0.0510  0.0001  0.0001  0.0001  0.0001

   4  0.0001  0.0029  0.0510   .
0.0240  0.0001  0.0001  0.0001

   5  0.0001  0.0001  0.0001  0.0240   .
0.0014  0.0001  0.0001

   6  0.0001  0.0001  0.0001  0.0001  0.0014
.      0.0285  0.0003

   7  0.0001  0.0001  0.0001  0.0001  0.0001
0.0285   .      0.1315

   8  0.0001  0.0001  0.0001  0.0001  0.0001
0.0003  0.1315   .

   9  0.8590  0.0390  0.0020  0.0001  0.0001
0.0001  0.0001  0.0001

  10  0.6895  0.1341  0.0113  0.0001  0.0001
0.0001  0.0001  0.0001

  11  0.6752  0.1392  0.0120  0.0001  0.0001
0.0001  0.0001  0.0001

  12  0.0016  0.1931  0.8054  0.0873  0.0001
0.0001  0.0001  0.0001

  13  0.0001  0.0111  0.1322  0.6500  0.0071
0.0001  0.0001  0.0001

  14  0.0001  0.0001  0.0001  0.0216  0.9668
0.0016  0.0001  0.0001

  15  0.0001  0.0001  0.0001  0.0009  0.2707
0.0329  0.0001  0.0001

  16  0.0001  0.0001  0.0001  0.0001 0.0001  0.1741
0.3977  0.0195

  17  0.7727  0.1080  0.0083  0.0001  0.0001
0.0001  0.0001  0.0001

  18  0.2682  0.4275  0.0655  0.0002  0.0001
0.0001  0.0001  0.0001

  19  0.1214  0.7279  0.1609  0.0010  0.0001
0.0001  0.0001  0.0001

  20  0.0840  0.8679  0.2217  0.0017  0.0001
0.0001  0.0001  0.0001

  21  0.0021  0.2205  0.8655  0.0742  0.0001
0.0001  0.0001  0.0001

  22  0.0001  0.0114  0.1346  0.6434  0.0069
0.0001  0.0001  0.0001

  23  0.0001  0.0001  0.0029  0.2869  0.2269
0.0001  0.0001  0.0001

  24  0.0001  0.0001  0.0001  0.0002  0.1135
0.0975  0.0002  0.0001

  25  0.9367  0.0490  0.0028  0.0001  0.0001
0.0001  0.0001  0.0001

  26  0.0909  0.8382  0.2078  0.0015  0.0001
0.0001  0.0001  0.0001

  27  0.0571  0.9907  0.2958  0.0031  0.0001
0.0001  0.0001  0.0001

  28  0.0001  0.0001  0.0001  0.0001  0.0485
0.2059  0.0007  0.0001

  29  0.0001  0.0001  0.0001  0.0001  0.0003
0.6687  0.0764  0.0012

  30  0.0001  0.0001  0.0001  0.0001  0.0001
0.0101  0.6935  0.2635

  31  0.0001  0.0001  0.0001  0.0001  0.0001
0.0003  0.1338  0.9926

  32  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0837  0.8221

Pr > |T| H0: LSMEAN(i)=LSMEAN(j)

   i/j     9      10
11      12
13      14
15      16

   1  0.8590  0.6895  0.6752  0.0016  0.0001
0.0001  0.0001  0.0001

   2  0.0390  0.1341  0.1392  0.1931  0.0111
0.0001  0.0001  0.0001

   3  0.0020  0.0113  0.0120  0.8054  0.1322
0.0001  0.0001  0.0001

   4  0.0001  0.0001  0.0001  0.0873  0.6500
0.0216  0.0009  0.0001

   5  0.0001  0.0001  0.0001  0.0001  0.0071
0.9668  0.2707  0.0001

   6  0.0001  0.0001  0.0001  0.0001  0.0001
0.0016  0.0329  0.1741

   7  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0001  0.3977

   8  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0001  0.0195

   9   .      0.5639  0.5509
0.0009  0.0001  0.0001  0.0001  0.0001

  10  0.5639   .      0.9845  0.0056
0.0001  0.0001  0.0001  0.0001

  11  0.5509  0.9845   .      0.0060
0.0001  0.0001  0.0001  0.0001

  12  0.0009  0.0056  0.0060   .
0.2070  0.0001  0.0001  0.0001

  13  0.0001  0.0001  0.0001  0.2070   .
0.0063  0.0002  0.0001

  14  0.0001  0.0001  0.0001  0.0001  0.0063
.      0.2891  0.0001

  15  0.0001  0.0001  0.0001  0.0001  0.0002
0.2891   .      0.0006

  16  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0006   .

  17  0.6410  0.9117  0.8964  0.0041  0.0001
0.0001  0.0001  0.0001

  18  0.1994  0.4781  0.4901  0.0373  0.0010
0.0001  0.0001  0.0001

  19  0.0847  0.2486  0.2566  0.1000  0.0041
0.0001  0.0001  0.0001

  20  0.0571  0.1823  0.1887  0.1427  0.0070
0.0001  0.0001  0.0001

  21  0.0012  0.0070  0.0075  0.9386  0.1809
0.0001  0.0001  0.0001

  22  0.0001  0.0001  0.0001  0.2104  0.9926
0.0061  0.0002  0.0001

  23  0.0001  0.0001  0.0001  0.0060  0.1299
0.2115  0.0219  0.0001

  24  0.0001  0.0001  0.0001  0.0001  0.0001
0.1231  0.6267  0.0029

  25  0.9217  0.6320  0.6182  0.0013  0.0001
0.0001  0.0001  0.0001

  26  0.0622  0.1949  0.2016  0.1328  0.0062
0.0001  0.0001  0.0001

  27  0.0379  0.1311  0.1361  0.1971  0.0115
0.0001  0.0001  0.0001

  28  0.0001  0.0001  0.0001  0.0001  0.0001
0.0534  0.3775  0.0094

  29  0.0001  0.0001  0.0001  0.0001  0.0001
0.0004  0.0108  0.3500

  30  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0001  0.2160

  31  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0001  0.0199

  32  0.0001  0.0001  0.0001  0.0001  0.0001
0.0001  0.0001  0.0107

and so forth. The total matrix of all
comparisons is of dimension 32*32 since there are 8*4=32 total treatments. Most of the
comparisons for which this two-dimensional table contains p-values should be ignored,
since they do not correspond to simple effects. To locate the comparisons of interest,
first locate the numbers for the means in question in the LSMEANS list. then locate the
row and column (or vice versa) for this comparison in the table of p-values. For example,
to find out which tissue types differ significantly from each other at -4 degrees
centigrade, the temperature at which a tissue effect was first found, locate the means

 

TISSUE   TEMP          LEAK
LSMEAN

LSMEAN    Number

1        -4
36.6480000     4

2        -4
25.4800000    12

3        -4
15.9200000    20

4        -4
64.3600000    28

in the table above. To test

Ho: at -4 degrees there is no difference between tissue
types 1 and 2,
locate the p-value in row 4,
column 12 or column 12, row 4. The p-value is 0.0873.

 

Tissue vs  Tissue   at Temp  Row  Column   p-value

   1         2
-4      12
4      0.0873

   1         3
-4      20
4      0.0017

   1         4
-4      28
4      0.0001

   2         3
-4      20
12      0.1427

   2         4
-4      28
12      0.0001

   3         4
-4      28
20      0.0001 (not shown)

Comparing cell
means in PROC MIXED is much more convenient compared to PROC GLM. The reason is that PROC
MIXED displays the results in a more user friendly manner. the statements

 

proc mixed data=leakage;
  class tissue temp;
  model leak = tissue temp tissue*temp;
  lsmeans tissue*temp / diff;
run;

accomplish this. Notice that the option is DIFF,
not PDIFF. The LSMEANS statement of PROC GLM does not have a DIFF option and the LSMEANS
statement of PROC MIXED does not have a PDIFF option. The portion of the output generated
by the DIFF option is

 

Std
  Effect    TISSUE TEMP _TISSUE _TEMP Difference
Error  DF      t Pr > |t|

TISSUE*TEMP   1     0
1     -2     -12.37
6.48 128  -1.91   0.0586

TISSUE*TEMP   1     0
1     -3     -19.25
6.48 128  -2.97   0.0036

TISSUE*TEMP   1     0
1     -4     -32.02
6.48 128  -4.94   0.0001

TISSUE*TEMP   1     0
1     -5     -46.82
6.48 128  -7.22   0.0001

TISSUE*TEMP   1     0
1     -6     -67.97
6.48 128 -10.49   0.0001

TISSUE*TEMP   1     0
1     -7     -82.33
6.48 128 -12.70   0.0001

TISSUE*TEMP   1     0
1     -8     -92.17
6.48 128 -14.22   0.0001

TISSUE*TEMP   1     0
2     0
1.15     6.48 128
0.18   0.8590

TISSUE*TEMP   1     0
2     -2
-2.60     6.48 128  -0.40    0.6895

TISSUE*TEMP   1     0
2     -3
-2.72     6.48 128  -0.42    0.6752

TISSUE*TEMP   1     0
2     -4     -20.85
6.48 128  -3.22   0.0016

TISSUE*TEMP   1     0
2     -5     -29.07
6.48 128  -4.48   0.0001

TISSUE*TEMP   1     0
2     -6     -47.09
6.48 128  -7.26   0.0001

TISSUE*TEMP   1     0
2     -7     -53.99
6.48 128  -8.33   0.0001

TISSUE*TEMP   1     0
2     -8     -76.83
6.48 128 -11.85   0.0001

TISSUE*TEMP   1     0
3     0
-1.88     6.48 128  -0.29
0.7727

TISSUE*TEMP   1     0
3     -2
-7.21     6.48 128  -1.11    0.2682

TISSUE*TEMP   1     0
3     -3     -10.11
6.48 128  -1.56   0.1214

TISSUE*TEMP   1     0
3     -4     -11.29
6.48 128  -1.74   0.0840

TISSUE*TEMP   1     0
3     -5     -20.35
6.48 128  -3.14   0.0021

TISSUE*TEMP   1     0
3     -6     -29.01
6.48 128  -4.48   0.0001

TISSUE*TEMP   1     0
3     -7     -38.95
6.48 128  -6.01   0.0001

TISSUE*TEMP   1     0
3     -8     -57.15
6.48 128  -8.82   0.0001

TISSUE*TEMP   1     0
4     0
0.52     6.48 128
0.08   0.9367

TISSUE*TEMP   1     0
4     -2     -11.04
6.48 128  -1.70   0.0909

TISSUE*TEMP   1     0
4     -3     -12.44
6.48 128  -1.92   0.0571

TISSUE*TEMP   1     0
4     -4     -59.73
6.48 128  -9.21   0.0001

TISSUE*TEMP   1     0
4     -5     -70.75
6.48 128 -10.91   0.0001

TISSUE*TEMP   1     0
4     -6     -84.89
6.48 128 -13.10   0.0001

TISSUE*TEMP   1     0
4     -7     -92.11
6.48 128 -14.21   0.0001

TISSUE*TEMP   1     0
4     -8     -93.63
6.48 128 -14.44   0.0001

TISSUE*TEMP   1     -2
1     -3      -6.88
6.48 128  -1.06   0.2905

TISSUE*TEMP   1     -2
1     -4     -19.65
6.48 128  -3.03   0.0029

TISSUE*TEMP   1     -2
1     -5     -34.45
6.48 128  -5.31   0.0001

TISSUE*TEMP   1     -2
1     -6     -55.60
6.48 128  -8.58   0.0001

TISSUE*TEMP   1     -2
1     -7     -69.96
6.48 128 -10.79   0.0001

TISSUE*TEMP   1     -2
1     -8     -79.80
6.48 128 -12.31   0.0001

TISSUE*TEMP   1     -2
2     0
13.52     6.48 128    2.09   0.0390

TISSUE*TEMP   1     -2
2     -2
9.77     6.48 128    1.51   0.1341

TISSUE*TEMP   1     -2
2     -3
9.65     6.48 128    1.49   0.1392

TISSUE*TEMP   1     -2
2     -4      -8.48
6.48 128  -1.31   0.1931

TISSUE*TEMP   1     -2
2     -5     -16.70
6.48 128  -2.58   0.0111

TISSUE*TEMP   1     -2
2     -6     -34.72
6.48 128  -5.36   0.0001

TISSUE*TEMP   1     -2
2     -7     -41.62
6.48 128  -6.42   0.0001

TISSUE*TEMP   1     -2
2     -8     -64.46
6.48 128  -9.94   0.0001

TISSUE*TEMP   1     -2
3     0
10.49     6.48 128    1.62   0.1080

TISSUE*TEMP   1     -2
3     -2
5.16     6.48 128    0.80   0.4275

TISSUE*TEMP   1     -2
3     -3
2.26     6.48 128    0.35   0.727

and so forth. The columns TISSUE TEMP list the
first combination of the two factors, the columns _TISSUE _TEMP the second combination
being compared to the first. For example, the second row compares tissue type 1 at
temperature 0 to tissue type 1 at temperature -3 degrees. Not only is this table easier to
read than the

 

 

 

proc mixed data=leakage;
  class tissue temp;
  model leak = tissue temp tissue*temp;
  lsmeans tissue*temp / diff;
  make 'diffs' out=diff noprint;
run;
data diff; set diff;
  if _effect_ = 'TISSUE*TEMP' then do;
     if temp ne _temp then delete;
     if (temp+0) > -4 then delete;
  end;
  LSD05 = tinv(0.975,_df_)*_se_;
  drop _effect_ _se_ _df_;
run;
proc print data=diff label noobs;
  format _diff_ 6.2 LSD05 5.1;
run;

The MAKE statement of PROC MIXED saves the table
of mean differences to the data set diff. It also prevents printing of all the differences
to the output window through the NOPRINT option. The DATA step after PROC MIXED deletes
all those comparisons for which the two temperatures are not the same. It also deletes
comparisons at temperatures below -4 degrees, since no significant slices were found
there. Also, the LSD at the 5% level is computed. Here is a printout of the data set diff:

 

TISSUE TEMP _TISSUE _TEMP Difference      t Pr > |t| LSD05

  1     -4     2
-4      11.17
1.72   0.0873  12.8

  1     -4     3
-4      20.73      3.20
0.0017  12.8

  1     -4     4
-4     -27.71    -4.28    0.0001  12.8

  1     -5     2
-5      17.75      2.74
0.0071  12.8

  1     -5     3
-5      26.47      4.08
0.0001  12.8

  1     -5     4
-5     -23.93    -3.69    0.0003  12.8

  1     -6     2
-6      20.88      3.22
0.0016  12.8

  1     -6     3
-6      38.96      6.01
0.0001  12.8

  1     -6     4
-6     -16.92    -2.61    0.0101  12.8

  1     -7     2
-7      28.34      4.37
0.0001  12.8

  1     -7     3
-7      43.38      6.69
0.0001  12.8

  1     -7     4
-7      -9.78    -1.51    0.1338
12.8

  1     -8     2
-8      15.34      2.37
0.0195  12.8

  1     -8     3
-8      35.02      5.40
0.0001  12.8

  1     -8     4
-8      -1.46    -0.23    0.8221
12.8

  2     -4     3
-4       9.56      1.47
0.1427  12.8

  2     -4     4
-4     -38.88    -6.00    0.0001  12.8

  2     -5     3
-5       8.72      1.35
0.1809  12.8

  2     -5     4
-5     -41.68    -6.43    0.0001  12.8

  2     -6     3
-6      18.08      2.79
0.0061  12.8

  2     -6     4
-6     -37.80    -5.83    0.0001  12.8

  2     -7     3
-7      15.04      2.32
0.0219  12.8

  2     -7     4
-7     -38.12    -5.88    0.0001  12.8

  2     -8     3
-8      19.68      3.04
0.0029  12.8

  2     -8     4
-8     -16.80    -2.59    0.0107  12.8

  3     -4     4
-4     -48.44    -7.47    0.0001  12.8

  3     -5     4
-5     -50.40    -7.78    0.0001  12.8

  3     -6     4
-6     -55.88    -8.62    0.0001  12.8

  3     -7     4
-7     -53.16    -8.20    0.0001  12.8

  3     -8     4
-8     -36.48    -5.63    0.0001  12.8

Slicing three-way and higher order interactions

Slicing a higher order interaction is
essentially no different from slicing a two-way interaction. You should slice, however, in
a manner that generates meaningful comparisons. For example, a significant A*B*C
interaction can be sliced in the following ways:

by A
by B
by C
by A*B
by A*C
by B*C
Only the last three are really meaningful, since
they compare the levels of one factor while holding the other two factors fixed. As a
general rule, if you write a slice statement the number of factors in the SLICE= option of
the LSMEANS statement should always be one less than the number of factors in the
interaction being sliced. For a three-way interaction, the statements are

 

lsmeans a*b*c / slice=a*b;
lsmeans a*b*c / slice=a*c;
lsmeans a*b*c / slice=b*c;

There is a shorthand for combining the three
statements into one:

 

lsmeans a*b*c / slice=(a*b a*c b*c);