SAS Textbook Examples
Design and Analysis by Keppel
Chapter 6

Chapter 6

Chapter 6: Analytical Comparisons Among Treatment Means

6. Comparison of Treatment Means in a One Way ANOVA, Page 120 of Keppel
  Example 6a. SPSS MANOVA
  Example 6b. SPSS GLM 
  Example 6c. SAS PROC GLM 

6. Comparison of Treatment Means in a One Way ANOVA, Page 120 of Keppel

Page 120 of Keppel illustrates how to compare treatment means in a one way Analysis of Variance.  This example compares the comprehension score (score) for three different instruction techniques. The data for this experiment is shown below.

a=1 a=2 a=3
16
18
10
12
19
4
6
8
10
2
2
10
9
13
11

This can be analyzed using SPSS manova, SPSS glm, or SAS proc glm. All of these examples use the CHAP2 (SPSS, SAS) data file. The following examples illustrate two comparisons: first, a comparison of group 1 with groups 2 and 3, and second a comparison of groups 2 and 3.

Example 6a. SPSS MANOVA

MANOVA score BY a(1,3)
  /ERROR = W
  /CONTRAST(a) = SPECIAL( 1   1   1
                          1 -.5 -.5
                          0   1  -1)
  /DESIGN = a(1) a(2) . 

The /contrast subcommand is used to specify comparisons among treatment means.  The /contrast subcommand supplies the contrast coefficients to be applied to factor A. The first row of coefficients is a series of 1's (corresponding to the number of levels of factor A). This row is always required. The coefficients in the second and third row form the first and second contrast applied to factor A. The second row specifies a contrast comparing a1 to (a2 and a3), while the third row specifies a contrast comparing a2 to a3. Note that the contrast coefficients correspond to those shown in Table 6-2 of Keppel.  The special matrix must always be square, so the third row of coefficients is required even if we were only interested in the first comparison.  In such a case, you can supply an additional comparison (preferably orthogonal to the previous rows).

The /design = a(1) a(2) subcommand tells SPSS to test the effect of the first and second contrast applied to a (i.e. the second and third row of the special matrix). The /contrast subcommand defines contrast, and the /design subcommand tells SPSS to include the contrast in the analysis.  A common error is to define a contrast with /contrast and to forget to tell SPSS to include the contrast via the /design subcommand.

Finally, the  /error=w is shown even though it was not necessary in this situation.  If we had only included one of the comparisons in the /design subcommand, then we would have wanted to include the /error=w to tell SPSS to use the within cells variance for computing the error term.  Otherwise, some versions of SPSS use WITHIN+RESIDUAL as the error term and this would be a less powerful test due to the addition of residual variance in the error term. 

Example 6b. SPSS GLM

GLM score BY a
  /LMATRIX a 1 -1/2 -1/2
  /LMATRIX a 0  1   -1. 

Example 6c. SAS PROC GLM

proc GLM data=chap2;
  class a;
  model score = a;
  contrast "1 vs 2&3" a  2 -1  -1;
  contrast "2 vs 3  " a  0  1  -1;
run;

Summary

Under construction.

How to cite this page

Report an error on this page or leave a comment

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.