UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS Textbook Examples
Design and Analysis by Keppel
Chapter 18

Chapter 18: The Mixed Two Factor Within-Subjects Design: Interaction Contrasts

Overview of Data File and Experimental Design
 18.1 Partial Interactions on the Repeated Factor, page 395
 18.2 Simple Comparison on the Repeated Factor, page 397
 18.3 Partial Interaction on the Between Factor , page 401
 18.4 Simple Comparison on the Between Factor, page 402
 18.5 Partial Interaction on the Between Factor (complex), page 403
 18.6 Simple Comparison on the Between Factor (complex), page 406
 18.7 Interaction Contrast, page 411
 18.8 Simple Comparison on the Repeated factor, page 412
 18.9 Simple Comparison on the Between factor, page 413

Overview of Data File and Experimental Design

Page 376 of Keppel illustrates a two way Between-Within Analysis of Variance.  In this example subjects perform a digit cancellation task and their performance on this task is measured.  The between factor (a) represents 3 different motivations, and the repeated factor (b) represents four trials on this task.  Four subjects were assigned to each of the 3 conditions, and their performance was measured on 4 trials.  The data for this study is shown below.

a s b1 b2 b3 b4
a=1
1
2
3
4
13
10
13
4
14
11
19
12
17
15
18
14
20
14
21
15
a=2 5
6
7
8
5
8
14
12
10
15
16
21
17
22
23
26
21
24
23
26
a=3 9
10
11
12
13
9
14
8
24
22
22
18
28
22
28
27
30
24
28
28

All of the analysis illustrated in this chapter use this data file and use the CHAP17w CHAP17w (SPSS, SAS) data file, except for the analyses using SPSS GLM which use the CHAP17n (SPSS, SAS) data file.

18.1 Partial Interactions on the Repeated Factor, page 395

On page 395, Keppel illustrates how to perform a partial interaction applying contrasts to the repeated factor (factor b).   This analysis evaluates the "A by Blinear" effect.  This analysis is illustrated below.

Example 18.a. SPSS MANOVA

MANOVA score1 score2 score3 score4 BY a(1,3)
  /WSFACTORS = b(4)
  /CONTRAST(b) = POLYNOMIAL
  /WSDESIGN = b(1) b(2) b(3)
  /DESIGN a. 

As we saw in Chapter 7, you can request tests of trend using the polynomial keyword with the /contrast subcommand.  The effect b(1) refers to the linear effect of b, b(2) is the quadratic effect of b and b(3) is the cubic effect of b.   When SPSS crosses the effects in the /design and /wsdesign subcommands, it creates a by b(1), a by b(2), and a by b(3). The a by b(1) effect corresponds to the "A by Blinear" partial interaction we wish to test.

Example 18.1b. SPSS GLM

GLM score1 score2 score3 score4 BY a
  /WSFACTOR = b 4 POLYNOMIAL. 

Example 18.1c. SAS PROC GLM

PROC GLM DATA=chap17w;
  CLASS a;
  MODEL score1 score2 score3 score4 = a ;
  REPEATED b 4 POLYNOMIAL / SUMMARY ;
RUN; 

18.2 Simple Comparison on the Repeated Factor, page 397

After finding a significant "A by Blinear" effect, Keppel follows this analysis with a simple comparison testing "Blinear at a1".  This analysis is illustrated below.

Example 18.2a. SPSS MANOVA

TEMPORARY.
SELECT IF (a = 1).
MANOVA score1 score2 score3 score4
  /WSFACTORS = b(4)
  /CONTRAST(b) = POLYNOMIAL
  /WSDESIGN = b(1) b(2) b(3). 

As with the previous example, the /contrast and /wsdesign subcommands are used to specify the Blinear effect.  This is combined with the

TEMPORARY.
SELECT IF (a = 1). 

to analyze just the subjects from a1, yielding the test of  "Blinear at a1".

Example 18.2b. SPSS GLM

TEMPORARY.
SELECT IF (a = 1).
GLM score1 score2 score3 score4
  /WSFACTOR = b 4 POLYNOMIAL. 

Example 18.2c. SAS PROC GLM

PROC GLM DATA=chap17w;
  WHERE (a = 1) ;
  MODEL score1 score2 score3 score4 = ;
  REPEATED b 4 POLYNOMIAL / SUMMARY ;
RUN; 

18.3 Partial Interaction on the Between Factor , page 401

Example 18.1 showed a partial interaction applying contrasts the the repeated factor.  This example shows a partial interaction applying contrasts to the between factor.  This analysis compares a2 with a3 across the levels of factor B, yielding partial interaction testing "Acomp by B". 

Example 18.3a. SPSS MANOVA

TEMPORARY.
SELECT IF (a = 2) or (a = 3).
MANOVA score1 score2 score3 score4 by a(2,3)
  /WSFACTORS = b(4). 

This analysis uses select if to select just the subjects from  a2 and a3. The a by b interaction in this case yields the partial interaction "Acomp by B" that we want to test. 

Example 18.3b. SPSS GLM

TEMPORARY.
SELECT IF (a = 2) or (a = 3).
GLM score1 score2 score3 score4 BY a
  /WSFACTOR = b 4 . 

Example 18.3c. SAS PROC GLM

PROC GLM DATA=chap17w;
  WHERE (a = 2) or (a = 3) ;
  CLASS a;
  MODEL score1 score2 score3 score4 = a ;
  REPEATED b 4 ;
RUN; 

18.4 Simple Comparison on the Between Factor, page 402

Even though the previous partial interaction was not significant, on page 402 Keppel illustrates a simple comparison that would have been a logical follow up to the previous partial interaction.  This simple comparison compares "a2 with a3 at b1", i.e. "Acomp at b1". 

Example 18.4a. SPSS MANOVA

TEMPORARY.
SELECT IF (a = 2) or (a = 3).
MANOVA score1 by a(2,3). 

This analysis is much like the partial interaction shown previously in example 18.3.  To isolate the comparison at level b1 we include just score1 on the manova statement.  The a effect from this analysis tests "a2 with a3 at b1".

Example 18.4b. SPSS GLM

TEMPORARY.
SELECT IF (a = 2) or (a = 3).
GLM score1 BY a. 

Example 18.4c. SAS PROC GLM

PROC GLM DATA=chap17w;
  WHERE (a = 2) or (a = 3) ;
  CLASS a;
  MODEL score1 = a ;
RUN; 

18.5 Partial Interaction on the Between Factor (complex), page 403

Although section 18.3 illustrated a partial interaction on a between factor, the contrast involved just compared  a2 with a3.  On page 403, Keppel illustrates a more complex contrast on the between factor comparing  a1 with ( a2 and a3).   This analysis shows how to obtain partial interaction "Acomp by B".

Example 18.5a. SPSS MANOVA

MANOVA score1 score2 score3 score4 by a(1,3)
  /WSFACTORS = b(4)
  /WSDESIGN = b
  /CONTRAST(a) = SPECIAL( 1  1  1
                          2 -1 -1
                          0  1 -1 ).
  /DESIGN = a(1) a(2) . 

The /contrast subcommand is used to form the comparison of  a1 with ( a2 and a3) and a second comparison is included just to make the special matrix square. When the effects in the /wsdesign and /design are crossed, it yields a(1) by b which forms the "Acomp by B" partial interaction of interest. (Please note that the results for the B effect in this analysis do not correspond to the results shown in Keppel.  We will be investigating this discrepancy.)

Example 18.5b. SPSS GLM

 **Under Construction** 

Example 18.5c. SAS PROC GLM

 **Under Construction** 

18.6 Simple Comparison on the Between Factor (complex), page 406

Having found a significant partial in the analysis above, Keppel follows it up with a simple comparison comparing  a1 with ( a2 and a3) at b1. This analysis is illustrated below.

Example 18.6a. SPSS MANOVA

MANOVA score1 by a(1,3)
  /CONTRAST(a) = SPECIAL( 1  1  1
                          2 -1 -1
                          0  1 -1 )
  /DESIGN = a(1) a(2) . 

The /contrast and /design subcommands are the same as the previous partial interaction, since both tests compared a1 with ( a2 and a3).  To isolate this effect at b1, only score1 is included on the manova statement.  This effect a(1) yields the "Acomp at b1" that we want to test.

Example 18.6b. SPSS GLM

 GLM score1 by a
  /LMATRIX a 2 -1 -1 . 

Example 18.6c. SAS PROC GLM

PROC GLM DATA=chap17w;
  CLASS a;
  MODEL score1 = a ;
  CONTRAST "a1 vs (a2 a3)" a 2 -1 -1 ;
RUN; 

18.7 Interaction Contrast, page 411

On pages 408-411 Keppel shows how to perform an interaction contrast.  This interaction contrast compares a2 with a3 and compares b1 with b4 simultaneously.   One way of thinking of this kind of interaction contrast is that it subsets the data creating a 2 by 2 analysis of  a2 a3 by   b1 b4 .

Example 18.7a. SPSS MANOVA

TEMPORARY.
SELECT IF (a = 2) or (a = 3).
MANOVA score1 score4 by a(2,3)
  /WSFACTORS = b(2). 

The interaction contrast is formed by using select if to choose just  a2 and a3 and including just score1 and score4 to just include b1 and b4 .   The a by b interaction tests the interaction contrast.

Example 18.7b. SPSS GLM

 Under Construction 

Example 18.7c. SAS PROC GLM

 Under Construction 

18.8 Simple Comparison on the Repeated factor, page 412

Even though the interaction contrast was not significant, Keppel follows up this test with simple comparisons that would have been logical follow ups to the interaction contrast.  The first simple comparison compares  b1 vs. b4 at  a2, i.e., "Bcomp at a2 ".

Example 18.8a. SPSS MANOVA

TEMPORARY.
SELECT IF (a = 2).
MANOVA score1 score4.
  /WSFACTORS = b(2). 

The select if command is used to choose just subjects from group a2, and  score1 and score4 to just include b1 and b4 .  The b effect tests the simple comparison of b1 vs. b4 at   a2.

Example 18.8b. SPSS GLM

TEMPORARY.
SELECT IF (a = 2).
GLM score1 score4
  /WSFACTOR = b 2. 

Example 18.8c. SAS PROC GLM

PROC GLM DATA=chap17w;
  WHERE (a = 2);
  MODEL score1 score4 =  ;
  REPEATED b 2 ;
RUN; 

18.9 Simple Comparison on the Between factor, page 413

The next simple comparison following the interaction contrast compares a2 vs. a3 at  b1, i.e., "Acomp at b1".

Exaple 18.9a. SPSS MANOVA

SELECT IF (a = 2) or (a = 3). 
MANOVA score1 by a(2,3). 

The manova statement includes just score1 which selects just b1 and b4 .  The select if command selects just a2 and a3 .   The a effect tests a2 vs. a3 at  b1,

Example 18.9b. SPSS GLM

 TEMPORARY.
SELECT IF (a = 2) or (a = 3).
GLM score1 by a. 

Example 18.9c. SAS PROC GLM

 PROC GLM DATA=chap17w;
  WHERE (a = 2) or (a = 3);
  CLASS a;
  MODEL score1 = a ;
RUN; 

Summary

Under construction.


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


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.