Research Methods II: Spring Term 2000

Using SPSS: Two-way Repeated-Measures ANOVA:

Suppose we have an experiment in which there are two independent variables:
*time of day * at which subjects are tested (with two levels: morning and
afternoon) and amount of *caffeine consumption *(with three levels: low,
medium and high). Subjects are given a memory test under all permutations of
these two variables. In other words, each subject's performance is tested six
times: after low, medium and high doses of caffeine in the morning, and after
low, medium and high doses of caffeine in the afternoon. (Each subject would
receive these six conditions in a different random order, to avoid systematic
effects of practice, etc.) A two-way repeated-measures ANOVA is the appropriate
test in these circumstances.

1. Entering the Data:

Entering the data is a little more complicated than with previous ANOVA's. (Or rather, it's a bit more complicated to explain: once you get the idea of what's required, it's not too difficult to do). Basically, we have to use a separate column for the data that come from each permutation of our two variables.

Assigning codes to the various conditions:

In this example, we have two IV's: *time of day* and *caffeine consumption.
Time of day* has two "levels": morning, and afternoon. *Caffeine consumption*
has three levels: low, medium and high.

We need to give code-numbers to the IV's, and to the levels of each IV, to help SPSS identify them correctly.

(a) Let's call *time of day* variable **1**, and *caffeine* *consumption*
variable **2**.

(b) For the levels of *time of day*, let's use a **1** to identify
"morning", and a **2** to identify "afternoon".

(c) For the levels of *caffeine consumption*, let's use a **1** to
identify "low". a **2** to identify "medium" and a **3** to identify "high".

Now each combination of code-numbers identifies a specific level of one or other of our variables, as follows:

**1,1 **means "time of day: morning; caffeine consumption: low".

**1,2 **means "time of day: morning"; caffeine consumption: medium".

**1,3** means "time of day: morning; caffeine consumption: high".

**2,1** means "time of day:afternoon; caffeine consumption: low".

**2,2** means "time of day: afternoon; caffeine consumption, medium".

**2,3** means "time of day: afternoon; caffeine consumption: high".

Entering the data into columns in SPSS:

With a one-way repeated-measures ANOVA, we entered the data for each condition
in a separate column (see Using SPSS handout 12). So, in this instance, if we
were interested only in the effects of caffeine (and had not considered time
of day), we would have had only three columns, for "low", "medium" and "high"
levels of caffeine. Now we have the additional variable of time of day and we
need to include the columns for these data somehow. In this example, the data
would be entered in six columns, one for each permutation of caffeine and time
of day. We need a separate column for each of the following: "morning, low caffeine"
data (**1,1** in our codes); "morning, medium caffeine" data (**1,2**),
"morning, high caffeine" (**1,3**); "afternoon, low caffeine" (**2,1**);
"afternoon, medium caffeine (**2,2**); and finally, "afternoon, low caffeine"
(**2,3**). Our SPSS data-screen might look like this (as usual, I've included
a column labelled "subject", to show whose data is whose, but it's not required
for the analysis).

Notice how I have arranged the columns. First, I have all the columns that
relate to the "morning" level of my *time of day* IV. So, I begin with
the columns which correspond to the various levels of *caffeine consumption*
(low, medium and high) for the morning testing. Then , I have all the columns
which relate to the "afternoon" level of the *time of day* variable. (It's
not strictly necessary to arrange the data like this, but it makes it easier
for you to keep track of what you are doing). I would strongly advise you to
label the columns with as meaningful titles as you can manage. Here, for example,
it's pretty obvious that "amlow" contains the data for the "morning testing
/low caffeine dose" data, "pmmedium" contains the data for the "afternoon testing/medium
caffeine dose" data, and so on.

Running the ANOVA:

Having entered your data, do the following.

(a) Click on "Statistics"; then click on "ANOVA models"; then click on "Repeated Measures". The "Repeated Measures Define Factor(s) dialog box:

(b) For each of your IV's, you have to make entries in this box. You have to tell SPSS the name of each IV, and how many levels it has.

Start with the *time of day* variable. Replace the words "factor 1" with
a more meaningful name that describes this variable - for example, "testtime".
Then enter the number of levels in the next box down. We have two levels of
*time of day*, so we enter a "2" in the box. Now click on the button labelled
"Add", and SPSS will put a brief summary of this IV into the box beside the
button. IN this case, SPSS will put "testtime(2)" into the box, as shown below:

(c) Repeat step (b) for the *caffeine consumption* IV. So, next to "within-subject
factor name", enter a label for this variable. I've used "caffeine". For this
variable, there are three levels, so I have entered "3" in the next box down.
Finally, click on "Add" to enter the details. Your dialog box will now look
like this:

(c) Now we have to tell SPSS which columns contain the data needed for the ANOVA. Click on the button labelled "Define". The "Repeated Measures Define Factor(s)" dialog box disappears, and is replaced with a new, fearsome-looking one, entitled "Repeated Measures ANOVA".

This looks horrendous, but stay calm. Let's take it bit by bit. On the left-hand side of the dialog box is a box containing the names of the columns in your SPSS data-window. On the right-hand side, is a box which contains empty slots (shown as _?_[1,1], for example).. Your mission, should you choose to accept it, is to move each column name on the left, into its correct slot on the right.

This is where all that fuss about column labelling and coding pays off. Take the top slot in the right-hand box: it's got (1,1) next to it. This means that this is the slot for the name of the column that represents the permutation of the first level of IV1 and the first level of IV2. In our example, this means the column containing the data for "morning/low caffeine consumption" (coded 1,1 earlier on). The next slot is for "morning/medium caffeine consumption" (which we coded as 1,2), and so on. Click on the slot first; then click on the appropriate column name; then click on the arrow-button between the boxes, to enter the column name into the slot. Do this for each slot in turn.

Your dialog box should end up looking like this:

(d) Now click on "Model". A new dialog box appears. Get rid of the tick next to "Multivariate tests", and click on "epsilon corrected average F" in case the sphericity assumption is violated (see last handout) and then click on "Continue" to return to the previous dialog box. Now click on "OK", to perform the ANOVA.

The ANOVA Output:

This is the output that you would get from our example. My explanations are the bold-type bracketed bits:

Note: there are 2 levels for the TESTTIME effect. Average tests are identical

to the univariate tests of significance.

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

* * * * * * A n a l y s i s o f V a r i a n c e * * * * * *

8 cases accepted.

0 cases rejected because of out-of-range factor values.

0 cases rejected because of missing data.

1 non-empty cell.

1 design will be processed.

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

[The following part of the output tests to see if the overall mean (of all your data) is significantly different from zero; this is usually not very interesting].

* * * * * * A n a l y s i s o f V a r i a n c e -- design 1 * * * * * *

Tests of Between-Subjects Effects.

Tests of Significance for T1 using UNIQUE sums of squares

Source of Variation | SS | DF | MS | F | Sig of F |

WITHIN+RESIDUAL | 65.65 | 7 | 9.38 | ||

CONSTANT | 11439.19 | 1 | 11439.19 | 1219.79 | .000 |

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

[The next part gives you the results for the "time of testing" variable: was test performance significantly affected by whether subjects were tested in the morning or the afternoon (ignoring the effects of caffeine dosage)? In this example, there is a highly significant F-ratio - time of testing had a significant effect on performance.]

* * * * * * A n a l y s i s o f V a r i a n c e -- design 1 * * * * * *

Tests involving 'TESTTIME' Within-Subject Effect.

Tests of Significance for T2 using UNIQUE sums of squares

Source of Variation | SS | DF | MS | F | Sig of F |

WITHIN+RESIDUAL | 35.48 | 7 | 5.07 | ||

TESTTIME | 540.02 | 1 | 540.02 | 106.55 | .000 |

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

[The next part gives you the results for the "caffeine" variable: was test performance significantly affected by the amount of caffeine subjects received (ignoring the effects of time of testing)?]

* * * * * * A n a l y s i s o f V a r i a n c e -- design 1 * * * * * *

[SPSS tests to see if it is okay to perform an ANOVA on your data; i.e. if the data satisfy relevant assumptions. In this example, the Mauchly Sphericity test is not significant. Thus, for simplicity, the output associated with the various corrections for sphericity violation will not be shown below],

Tests involving 'CAFFEINE' Within-Subject Effect.

Mauchly sphericity test, W = .93181

Chi-square approx. = .42378 with 2 D. F.

Significance = .809

Greenhouse-Geisser Epsilon = .93616

Huynh-Feldt Epsilon = 1.00000

Lower-bound Epsilon = .50000

AVERAGED Tests of Significance that follow multivariate tests are equivalent to

univariate or split-plot or mixed-model approach to repeated measures.

Epsilons may be used to adjust d.f. for the AVERAGED results.

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

* * * * * * A n a l y s i s o f V a r i a n c e -- design 1 * * * * * *

[This is the bit that is of interest - the results for the "caffeine" variable. In this example, we have a highly significant effect of caffeine consumption on memory performance. ]

Tests involving 'CAFFEINE' Within-Subject Effect.

AVERAGED Tests of Significance for MEAS.1 using UNIQUE sums of squares

Source of Variation | SS | DF | MS | F | Sig of F |

WITHIN+RESIDUAL | 148.29 | 14 | 10.59 | ||

CAFFEINE | 197.37 | 2 | 98.69 | 9.32 | .003 |

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

[The next section gives information on the interaction between your IV's: do the effects of one IV depend on the level of the other IV? In other words, in this case, did the effects of caffeine on performance depend on the time of day at which people were tested? As before, you get the Mauchly-Sphericity test results, which were nonsignificant.]

* * * * * * A n a l y s i s o f V a r i a n c e -- design 1 * * * * * *

Tests involving 'TESTTIME BY CAFFEINE' Within-Subject Effect.

Mauchly sphericity test, W = .73682

Chi-square approx. = 1.83245 with 2 D. F.

Significance = .400

Greenhouse-Geisser Epsilon = .79165

Huynh-Feldt Epsilon = .98459

Lower-bound Epsilon = .50000

AVERAGED Tests of Significance that follow multivariate tests are equivalent to

univariate or split-plot or mixed-model approach to repeated measures.

Epsilons may be used to adjust d.f. for the AVERAGED results.

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

[The interaction between our IV's. In this example, there is a significant interaction between time of testing and caffeine consumption: the effects of caffeine depend on what time of day people were tested.

* * * * * * A n a l y s i s o f V a r i a n c e -- design 1 * * * * * *

Tests involving 'TESTTIME BY CAFFEINE' Within-Subject Effect.

AVERAGED Tests of Significance for MEAS.1 using UNIQUE sums of squares

Source of Variation | SS | DF | MS | F | Sig of F |

WITHIN+RESIDUAL | 55.71 | 14 | 3.98 | ||

TESTTIME BY CAFFEINE | 49.29 | 2 | 24.65 | 6.19 | .012 |

Post hoc tests

You may wish to analyze two effects further: the main effect of caffeine and the interaction. Taking these cases in turn:

**Interpreting a main effect**

For the main effect of testtime there is no further inferential test that needs to be done: Subjects overall have different levels of performance in the morning rather than the afternoon and that’s that. There are only two levels and we know there is a difference so there is nothing more to be tested. However, the main effect of caffeine indicates that at least one level is different from at least one other, but we don’t know what the pattern is. So we may like to perform post hoc tests to determine the pattern. Remember you would go on to perform these post hoc tests ONLY IF the main effect was significant. But just because the main effect is significant, it does not mean you have to perform the post hoc tests – just do so if you are interested in the pattern. You might argue that since the main effect is qualified by an interaction, that means the pattern is an average of two possibly quite different patterns (one in the morning and one in the afternoon) and you are not interested in the average of two quite different things. So then you would just go on to interpret the interaction.

Assuming you did want to analyze the main effect further, how would you
do it? There are a number of techniques you could do, and this is something
you will want to check with your supervisor if it comes up in your project.
You could use the same procedure as we used for the one-way repeated measures
case. That is, you perform comparisons between each possible pair of levels:
low with medium, low with high, and medium with high. The complication in this
case compared with the one-way case is that we want to perform these comparisons
*averaging over time of day*. Here’s the quickest way of getting SPSS to
do this. Click once more on:

Statistics > ANOVA models > Repeated Measures

tell SPSS that you have two factors, but this time say that they only have two levels each. For caffeine enter the two levels as low and medium. Just enter four columns when it asks you to match columns to combinations of IVs: morning low, morning medium, afternoon low, afternoon medium. In the results, the ONLY effect you are interested in is the main effect of caffeine. This is a test of whether low is different from medium, averaging over time of day. Ignore the results for all other effects in this output. Repeat the procedure for the other two pair-wise comparisons.

Interpreting an interaction

Just as for the second module, if you have a significant interaction, you may be interested in gaining further information on the pattern of the interaction. Just as before, you could break down the interaction in two ways:

1) the effect of caffeine in the morning; and the effect of caffeine in the afternoon; OR

2) the effect of time of day at low doses of caffeine; the effect of time of day a medium doses; and the effect of time of day at high doses.

Choose ONE of these ways of breaking it down, unless you have a theory that
makes important predictions according to both ways. For (1) you would determine
the **simple effect **of caffeine for each time of day separately.

Click once more on

Statistics > ANOVA models > Repeated Measures

tell SPSS that you have one factor, caffeine, with three levels. Just select the three columns for morning and run the one-way ANOVA. This is the effect of caffeine in the morning. If significant (which it is), you could perform further post hoc tests to determine the pattern of mean differences; e.g. all possible pairwise comparisons, and you just follow the procedure in the preceding handout. That is, click once more on

**Statistics > ANOVA models > Repeated Measures**

tell SPSS you have one factor, caffeine, with TWO levels. Select two of the levels and run the one-way ANOVA. (Note: You could have run a t-test using the related t-test command and you would get exactly the same p value out. In fact, if you squared the t-value you would get the F value. The two procedures are equivalent when there are only two levels of a single IV.) Having conducted all possible pair-wise comparisons, determine the simple effect of caffeine for the afternoon, followed up by post hoc tests.

For (2), you would determine the simple effect of time of day for each level of caffeine. That is, you would compare morning low with afternoon low, using either related t-tests or the repeated measures one-way ANOVA; then compare morning medium with afternoon medium in the same way; and finally morning high with afternoon high.

Interpreting the Results:

As usual , you need to get some descriptive statistics in order to make sense
of what the ANOVA results are telling you. The simplest way is to click on "Summarize"
on the SPSS controls, then click on "Descriptives". Move the column names from
the left-hand box to the right-hand box, to get SPSS to provide you with means,
etc. Here's the output for the current example. As you can see, the means for
the "morning" sessions are lower than those for the "afternoon" sessions (as
confirmed by the significant effect of *time of testing* in the ANOVA output).
At both testing-times, the more caffeine, the better the memory performance
(as confirmed by the significant effect of *caffeine consumption* in the
ANOVA output, by the simple effects of caffeine for each time). However, this
trend is more pronounced when testing was in the morning than when it took place
in the afternoon (which is why there is a significant interaction between *time
of testing* and *caffeine consumption* in the output). The graph shows
this more clearly (remember to add standard errors to your own graphs!).

Variable | Mean | Std Dev | Minimum | Maximum |
Valid N |

AMLOW | 10.88 | 1.25 | 9.00 | 13.00 | 8 |

AMMEDIUM | 11.88 | 2.90 | 6.00 | 15.00 | 8 |

AMHIGH | 13.50 | 2.33 | 11.00 | 17.00 | 8 |

PMLOW | 14.75 | 3.99 | 9.00 | 21.00 | 8 |

PMMEDIUM | 19.63 | 2.77 | 16.00 | 24.00 | 8 |

PMHIGH | 22.00 | 2.14 | 19.00 | 26.00 | 8 |