UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SPSS Textbook Examples
Design & Analysis by Keppel
Chapter 17

Chapter 17: The Mixed Two Factor Within-Subjects Design

17.1 Two Way Between-Within ANOVA, Page 375 of Keppel
17.2 Comparisons on the Between Factor, Page 380 of Keppel
17.3 Comparisons on the Within Factor, Page 382 of Keppel
17.4 Simple Effects using Within Factor, Page 385 of Keppel
17.5 Simple Comparisons on the Within Factor, Page 385 of Keppel
17.6 Simple Effects of the Between Factor, Page 388 of Keppel
17.7 Simple Comparisons on the Between Factor, Page 388 of Keppel

17.1 Two Way Between-Within ANOVA, Page 375 of Keppel

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. The following examples illustrate how to perform a two way Between-Within ANOVA  with this data file.

Example 17.1a. SPSS MANOVA

MANOVA score1 score2 score3 score4 BY a(1,3)
  /WSFACTORS = b(4). 

As you might expect, the manova command for a Between-Within ANOVA combines features from a Oneway Between ANOVA (see Chapter 3) and a Oneway Within ANOVA (see chapter 16).  The by a(1,3) indicates the between subjects factor a, while the /wsfactors = b(4) indicates that score1 - score4 represent the within subjects variable with 4 levels.  This setup produces a Two Way Between-Within ANOVA.

Example 17.1b. SPSS GLM

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

Example 17.1c. SAS PROC GLM

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

17.2 Comparisons on the Between Factor, Page 380 of Keppel

Having found a significant main effect of the Between Factor (a), Keppel illustrates how to perform comparisons on factor a on page 380, comparing a2 with a3.

Example 17.2a. SPSS MANOVA

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

As we saw in Chapter 6, performing comparisons involve using the /contrast and /design subcommands.  The first contrast compares a2 with a3.  A second contrast is included that compares a1 to (a2 and a3).  The second contrast is included because the special matrix must be square. 

Example 17.2b. SPSS GLM

 GLM score1 score2 score3 score4 BY a
  /WSFACTOR = b 4
  /WSDESIGN = b
  /DESIGN = a
  /LMATRIX a 0  1   -1
  /LMATRIX a 1 -1/2 -1/2. 

Example 17.2c. SAS PROC GLM

 **Under Construction** 

17.3 Comparisons on the Within Factor, Page 382 of Keppel

Having found a significant main effect of the Within Factor (b), Keppel illustrates how to perform comparisons on factor b on page 382, comparing b1 with b4.  Keppel advises on performing such comparisons using only the data from  b1 and b4 to obtain a proper error term.  These analyses reflect this advice (see Keppel, especially pages 383 and 383 for more information on the selection of error terms when using comparisons involving the Within Subjects factor).

Example 17.3a. SPSS MANOVA

MANOVA score1 score4 BY a(1,3)
  /WSFACTORS = b(2). 

To compare b1 with b4 , we name just score1 and score4 on the manova command, and modify the /wsfactors subcommand to reflect only 2 levels for factor b.  By selecting just score1 and score4, this test compares b1 with b4.

Example 17.3b. SPSS GLM

GLM score1 score4 BY a
  /WSFACTOR = b 2
  /WSDESIGN = b
  /DESIGN = a . 

Example 17.3c. SAS PROC GLM

PROC GLM DATA=chap17w;
  CLASS a;
  MODEL score1 score4 = a ;
  REPEATED b 4 ;
RUN; 

17.4 Simple Effects using Within Factor, Page 385 of Keppel

On page 384 Keppel illustrates how to perform a simple effect of the repeated factor (factor b) at level  a3 of the between factor. Like the analysis above, Keppel advises on performing such comparisons using only the data from  a3.  In effect, the simple effects analysis becomes a oneway within subjects ANOVA at level  a3.

Example 17.4a. SPSS MANOVA

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

To perform the simple effects analysis at level a3, we use

TEMPORARY.
SELECT IF (a = 3). 

which limits the analysis to just group 3 on factor a.   The manova statements are the same statements you would use for a oneway within subjects ANOVA (see chapter 16).

Example 17.4b. SPSS GLM

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

Example 17.4c. SAS PROC GLM

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

17.5 Simple Comparisons on the Within Factor, Page 385 of Keppel

On page 385, Keppel illustrates how to perform a simple comparison on the repeated factor (factor b) comparing  b1 with  b4 at level a3 of the between factor.   As we would expect, this analysis will be limited just to the data involved in the comparison.  This analysis will include just the data from group a3 and just   b1 with  b4 of the repeated factor.

Example 17.5a. SPSS MANOVA

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

To perform the simple comparison, we use

TEMPORARY.
SELECT IF (a = 3). 

to limit the analysis to just group 3 on factor a, and include just score1 and score4 to select just  b1 with  b4 of the repeated factor. This produces a comparison of   b1 with  b4 at level  a3.

Example 17.5b. SPSS GLM

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

Example 17.5c. SAS PROC GLM

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

17.6 Simple Effects of the Between Factor, Page 402 of Keppel

Having found a significant main effect of the Between Factor (a), Keppel illustrates how to test the simple effect of the between factor (a) at b4 of the repeated factor (i.e., the effect of a for the last trial). This analysis is illustrated below.

Example 17.6a. SPSS MANOVA

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

In example 11.2 of chapter 11 we examined how to request simple effects in a two way between subjects ANOVA.  In that example, we requested the simple effect of a at b4 and b2 using the following /design subcommand.

/DESIGN = a WITHIN b(1) 
          a WITHIN b(2).

Here we wish to obtain the effect of a at b1 so you might wonder why we did not specify something like

a WITHIN b(4) .    

SPSS does not permit this because it would mention a within subjects factor (b) on the /design subcommand, which must only include between subjects factors.  Likewise, the /wsdesign subcommand can only include within subjects factors.  To solve this, SPSS created the mwithin keyword as illustrated in our example here. By default, SPSS crosses all of the effects on the /design subcommand with all of the factors on the /wsdesign subcommand.  When a is crossed with mwithin b(4) this yields a mwithin b(4) which SPSS interprets as the simple effect of a at b4.

In short, we wanted the simple effect of a (the between factor) at b4 (the within factor), so we specify the between factor on the /design subcommand, and mwithin b(4) on the /wsdesign subcommand.

Example 17.6b. SPSS GLM

GLM score1 score2 score3 score4 BY a
  /WSFACTOR = b 4
  /EMMEANS TABLES(a*b) COMPARE(a). 

Example 17.6c. SAS PROC GLM

PROC GLM DATA=chap17w;
  CLASS a;
  MODEL score4 = a ;
RUN; 

17.7 Simple Comparisons on the Between Factor, Page 388 of Keppel

Having found a significant simple effect of the Between Factor (a) at b4 of the repeated factor, Keppel then illustrates how to perform a simple comparison comparing a1 to (a2 and a3) at b4 on page 388.

Example 17.7a. SPSS MANOVA

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

The setup for this simple comparison is quite similar to the setup for the simple effect shown in section 17.6 above.  The /contrast subcommand is used for form a comparison of a1 to (a2 and a3).  To make the special matrix square, we include a second comparison of a2 with a3 which is not of interest to us.  By specifying a(1) on the /design subcommand, and mwithin b(4) on the /wsdesign subcommand, SPSS will cross these to form an effect a(1) mwithin b(4) which will compare a1 to (a2 & a3) at b4.

Example 17.7b. SPSS GLM

GLM score4 BY a
  /LMATRIX a 2 -1 -1. 

Example 17.7c. SAS PROC GLM

PROC GLM DATA=chap17w;
  CLASS a;
  MODEL score4 = a ;
  CONTRAST "a1 vs (a2 a3) @b4" a 2 -1 -1 ;
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