# Two-way repeated measures ANOVA using SPSS Statistics

## Introduction

A two-way repeated measures ANOVA (also known as a two-factor repeated measures ANOVA, two-factor or two-way ANOVA with repeated measures, or within-within-subjects ANOVA) compares the mean differences between groups that have been split on two within-subjects factors (also known as independent variables). A two-way repeated measures ANOVA is often used in studies where you have measured a dependent variable over two or more time points, or when subjects have undergone two or more conditions (i.e., the two factors are "time" and "conditions"). The primary purpose of a two-way repeated measures ANOVA is to understand if there is an interaction between these two factors on the dependent variable. Take a look at the examples below:

• Example #1
• Example #2

Imagine that a health researcher wants to help suffers of chronic back pain reduce their pain levels. The researcher wants to find out whether one of two different treatments is more effective at reducing pain levels. Therefore, 30 participants take part in the experiment. The two treatments, known as "conditions", are a "massage programme" (treatment A) and "acupuncture programme" (treatment B). Both programmes last 8 weeks. Therefore, the dependent variable is "back pain", whilst the two factors are the "conditions" (i.e., two groups: "treatment A", the massage programme, and "treatment B", the acupuncture programme) and "time" (i.e., back pain at three time points, which are our three groups: "at the beginning of the programme", "midway through the programme" and "at the end of the programme").

All 30 participants undergo treatment A and treatment B. However, the order in which they receive this differs, with the 30 employees being randomly split into two groups: (a) 15 participants first undergo treatment A and then treatment B, whilst (b) the other 15 participants start with treatment B and then undergo treatment A (i.e., this is known as counterbalancing and helps to reduce the bias that could result from the order in which a condition is provided).

At the end of the experiment, the researcher uses a two-way repeated measures ANOVA to determine whether any change in back pain (i.e., the dependent variable) is the result of the interaction between the "type of treatment" (i.e., the massage programme or acupuncture programme, which is one of our two factors) and "time" (i.e., our second factor). Irrespective of whether there is an interaction, follow-up tests can be performed to determine in more detail how the within-subjects factors affected back pain.

Imagine that an online retailer wants to improve productivity amongst packers in their order fulfillment centre. The retailer wants to find out whether providing the packers with background music improves productivity. Therefore, 200 packers take part in the experiment, which has a "control", where "no music" is played, and a "treatment", where "music" is played. However, the retailer also wants to know whether any possible increase in productivity is affected by the time that the music is played (i.e., if there was an increase in productivity when music was provided, is this a long-term increase or perhaps only due to initial novelty?). Therefore, the dependent variable is "productivity" (measured in terms of the average number of packages fulfilled), whilst the two factors are the "conditions" (i.e., two groups: "control" or "treatment") and "time" (i.e., productivity at three time points, which are our three groups: "at the beginning of the experiment", "1 week later" and "4 weeks later").

All 200 employees undergo the treatment and control. However, the order in which they receive this differs, with the 200 employees being randomly split into two groups: (a) 100 packers first undergo the control and then the treatment, whilst (b) the other 100 packers start with the treatment and then undergo the control (i.e., this is known as counterbalancing and helps to reduce the bias that could result from the order in which a condition is provided).

At the end of the experiment, the retailer uses a two-way repeated measures ANOVA to determine whether any change in productivity (i.e., the dependent variable) is the result of the interaction between the use of music (i.e., the "conditions", which is one of our factors) and "time" (i.e., our second factor). Irrespective of whether there is an interaction, follow-up tests can be performed to determine in more detail how the within-subjects factors affected back pain.

Once you have established whether there is a statistically significant interaction, there are a number of different approaches to following up the result. In particular, it is important to realize that the two-way repeated measures ANOVA is an omnibus test statistic and cannot tell you which specific groups within each factor were significantly different from each other. For example, if one of your factors (e.g., "time") has three groups (e.g., the three groups are your three time points: "time point 1", "time point 2" and "time point 3"), the two-way repeated measures ANOVA result cannot tell you whether the values on the dependent variable were different for one group (e.g., "Time point 1") compared with another group (e.g., "Time point 2"). It only tells you that at least two of the groups were different. Since you may have three, four, five or more groups in your study design, as well as two factors, determining which of these groups differ from each other is important. You can do this using post hoc tests, which we discuss later in this guide. In addition, where statistically significant interactions are found, you need to determine whether there are any "simple main effects", and if there are, what these effects are (again, we discuss later in our guide).

If you are unsure whether a two-way repeated measures ANOVA is appropriate, you may also want to consider how it differs from a one-way repeated measures ANOVA and a mixed ANOVA. A two-way repeated measures ANOVA goes further than a one-way repeated measures ANOVA, which only has one factor (i.e., one independent variable). For example, a one-way repeated measures ANOVA could be used when you only wanted to know whether there was a difference in chronic back pain before and after a back rehabilitation course (i.e., you only have one factor, which is "time", where you are comparing two groups, namely the two time points: "before" and "after" the back rehabilitation course). You should also distinguish between the two-way repeated measures ANOVA and the mixed ANOVA. A mixed ANOVA is very similar to a two-way repeated measures ANOVA because both of these statistical tests involve two factors (often "time" and some kind of "condition"), as well as a desire to understand whether there is an interaction between these two factors on the dependent variable. However, the fundamental difference is that in a mixed ANOVA, the subjects that undergo each condition (e.g., a control and treatment) are different, whereas in a two-way repeated measures ANOVA, the subjects undergo both conditions (e.g., they undergo the control and the treatment). Therefore, if you think that the two-way repeated measures ANOVA is not the test you are looking for, you may want to consider a one-way repeated measures ANOVA or mixed ANOVA. Alternately, if neither of these are appropriate, you can use our Statistical Test Selector, which is part of our enhanced content, to determine which test is appropriate for your study design.

In this "quick start" guide, we show you how to carry out a two-way repeated measures ANOVA with post hoc tests using SPSS Statistics, as well as the steps you will need to go through to interpret the results from this test. However, before we introduce you to this procedure, you need to understand the different assumptions that your data must meet in order for a two-way repeated measures ANOVA to give you a valid result. We discuss these assumptions next.

## Assumptions

When you choose to analyse your data using a two-way repeated measures ANOVA, part of the process involves checking to make sure that the data you want to analyse can actually be analysed using a two-way repeated measures ANOVA. You need to do this because it is only appropriate to use a two-way repeated measures ANOVA if your data "passes" five assumptions that are required for a two-way repeated measures ANOVA to give you a valid result. In practice, checking for these assumptions requires you to use SPSS Statistics to carry out a few more tests, as well as think a little bit more about your data, but it is not a difficult task.

Before we introduce you to these five assumptions, do not be surprised if, when analysing your own data using SPSS Statistics, one or more of these assumptions is violated (i.e., not met). This is not uncommon when working with real-world data rather than textbook examples. However, even when your data fails certain assumptions, there is often a solution to try and overcome this. First, letâ€™s take a look at these five assumptions:

• Assumption #1: Your dependent variable should be measured at the continuous level (i.e., they are interval or ratio variables). Examples of continuous variables include revision time (measured in hours), intelligence (measured using IQ score), exam performance (measured from 0 to 100), weight (measured in kg), and so forth. You can learn more about interval and ratio variables in our article: Types of Variable.
• Assumption #2: Your two within-subjects factors (i.e., two independent variables) should consist of at least two categorical, "related groups" or "matched pairs". "Related groups" indicates that the same subjects are present in both groups. The reason that it is possible to have the same subjects in each group is because each subject has been measured on two occasions on the same dependent variable. For example, you might have measured 10 individuals' performance in a spelling test (the dependent variable) before and after they underwent a new form of computerized teaching method to improve spelling. You would like to know if the computer training improved their spelling performance. The first related group consists of the subjects at the beginning (prior to) the computerized spelling training and the second related group consists of the same subjects, but now at the end of the computerized training. The two-way repeated measures ANOVA can also be used to compare different subjects, but this does not happen very often. Nonetheless, to learn more about the different study designs you use with a two-way repeated measures ANOVA, see our enhanced two-way repeated measures ANOVA guide.
• Assumption #3: There should be no significant outliers in any combination of the related groups. Outliers are simply single data points within your data that do not follow the usual pattern (e.g., in a study of 100 students' IQ scores, where the mean score was 108 with only a small variation between students, one student had a score of 156, which is very unusual, and may even put her in the top 1% of IQ scores globally). The problem with outliers is that they can have a negative effect on the two-way repeated measures ANOVA, distorting the differences between the related groups (whether increasing or decreasing the scores on the dependent variable), which reduces the accuracy of your results. Fortunately, when using SPSS Statistics to run a two-way repeated measures ANOVA on your data, you can easily detect possible outliers. In our enhanced two-way repeated measures ANOVA guide, we: (a) show you how to detect outliers using SPSS Statistics; and (b) discuss some of the options you have in order to deal with outliers.
• Assumption #4: The distribution of the dependent variable in each combination of the related groups should be approximately normally distributed. We talk about the two-way repeated measures ANOVA only requiring approximately normal data because it is quite "robust" to violations of normality, meaning that assumption can be a little violated and still provide valid results. You can test for normality using the Shapiro-Wilk test of normality (using residuals), which is easily tested for using SPSS Statistics. In addition to showing you how to do this in our enhanced two-way repeated measures ANOVA guide, we also explain what you can do if your data fails this assumption (i.e., if it fails it more than a little bit).
• Assumption #5: Known as sphericity, the variances of the differences between all combinations of related groups must be equal. Fortunately, SPSS Statistics makes it easy to test whether your data has met or failed this assumption. Therefore, in our enhanced two-way repeated measures ANOVA guide, we (a) show you how to perform Mauchly's Test of Sphericity in SPSS Statistics, (b) explain some of the things you will need to consider when interpreting your data, and (c) present possible ways to continue with your analysis if your data fails to meet this assumption.

You can check assumptions #3, #4 and #5 using SPSS Statistics. Just remember that if you do not run the statistical tests on these assumptions correctly, the results you get when running a two-way repeated measures ANOVA might not be valid. This is why we dedicate a number of sections in our enhanced guides to help you get this right. You can find out about our enhanced content as a whole on our Features: Overview page, or more specifically, learn how we help with testing assumptions on our Features: Assumptions page.

In the section, Procedure, we illustrate the SPSS Statistics procedure that you can use to carry out a two-way repeated measures ANOVA on your data. First, we introduce the example that is used in this guide.

## Example

A researcher was interested in discovering whether a short-term (2-week) high-intensity exercise-training programme can elicit reductions in a marker of heart disease called C-Reactive Protein (CRP). To answer this question, the researcher recruited 12 subjects and had them perform two trials/treatments – a control trial and an intervention trial – which were counterbalanced and with sufficient time between trials to allow for residual effects to dissipate. In the control trial, subjects continued their normal activities, whilst in the intervention trial, they exercised intensely for 45 minutes each day. CRP concentration was measured three times: at the beginning, midway (one week) and at the end of the trials. For the control trial, the two within-subjects factors are time, time, and treatment (i.e., control or intervention), treatment, and the dependent variable is CRP. In variable terms, the researcher wishes to know if there is an interaction between time and treatment on CRP.

## Setup in SPSS Statistics

In our enhanced two-way repeated measures ANOVA guide, we show you how to correctly enter data in SPSS Statistics to run a two-way repeated measures ANOVA. You can learn about our enhanced data setup content on our Features: Data Setup page. Alternately, see our generic, "quick start" guide: Entering Data in SPSS Statistics.

## Test Procedure in SPSS Statistics

The General Linear Model > Repeated Measures... procedure below shows you how to analyse your data using a two-way repeated measures ANOVA in SPSS Statistics, including which post hoc test to select to determine where any differences lie, when none of the five assumptions in the previous section, Assumptions, have been violated. At the end of these steps, we explain what results you will need to interpret from your two-way repeated measures ANOVA. If you are looking for help to make sure your data meets assumptions #3, #4 and #5, which are required when using a two-way repeated measures ANOVA and can be tested using SPSS Statistics, we show you how to do this in our enhanced content (see our Features: Overview page to learn more).

Since some of the options in the General Linear Model > Repeated Measures... procedure changed in SPSS Statistics version 25, we show how to carry out a two-way repeated measures ANOVA in SPSS Statistics version 25 and above (which includes the subscription version of SPSS Statistics) and version 24 and earlier.

Note: If you are unsure which version of SPSS Statistics you are using, see our guide: Identifying your version of SPSS Statistics.

##### SPSS Statistics version 25 and above (which includes the subscription version of SPSS Statistics)
1. Click Analyze > General Linear Model > Repeated Measures... on the top menu, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

You will be presented with the Repeated Measures Define Factor(s) dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

2. In the Within-Subject Factor Name: box, replace "factor1" with the name of your first within-subject factor. In this example, replace it with the name "treatment" because this reflects the first within-subject factor, treatment. Enter into the Number of Levels: box the number of treatments (i.e., the number of levels of the within-subject factor). In this case, enter "2", which represents the control and intervention trials.

Note: It does not matter which within-subject factor is entered first.

Published with written permission from SPSS Statistics, IBM Corporation.

Click on the button and you will get the following screen:

Published with written permission from SPSS Statistics, IBM Corporation.

3. Enter a name for the second within-subjects factor into the Within-Subject Factor Name: box. In this example, enter "time", which represents the variable time. Enter into the Number of Levels: box the number of time points (i.e., the number of levels of the within-subject factor). In this case, enter "3", which represents the beginning, midway and end time points. Then, click on the button. You will end up with the screen below:

Published with written permission from SPSS Statistics, IBM Corporation.

4. Click on the button and you will be presented with the Repeated Measures dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

5. Transfer all the variables into the Within-Subjects Variables (treatment,time): box by highlighting all the variables (clicking on them whilst holding down the shift-key) in the left-hand box and clicking on the top button. You will end up with the following screen:

Note: The bracketed information – i.e., (treatment,time) – tells you how the variables should be entered. For example, (1,3) means level one of treatment (intervention) and level 3 of time (post), which is represented by the variable int_3.

Published with written permission from SPSS Statistics, IBM Corporation.

6. Click on the button and you will be presented with the Repeated Measures: Profile Plots dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

7. Transfer treatment from the Factors: box to the Separate Lines: box and time into the Horizontal Axis: box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

Note: This particular setup works well for this example. However, which within-subject factor takes the role of the horizontal axis and which the separate lines for your study is up to you (i.e., whatever makes the most sense to you).

8. Click on the button and this will add this plot, labelled "time*treatment", into the Plots: box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

9. Click on the button. You will be returned to the Repeated Measures dialogue box.
10. Click on the button and you will be presented with the Repeated Measures: Estimated Marginal Means dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

11. Transfer treatment, time and treatment*time from the Factor(s) and Factor Interactions: box to the Display Means For: box by highlighting them and clicking on the button. This will activate the Compare main effects checkbox (i.e., it will no longer be grayed out). Tick this checkbox and select from the drop-down menu under Confidence interval adjustment:. You will be presented with the following screen:

Published with written permission from SPSS Statistics, IBM Corporation.

12. Click on the button. You will be returned to the Repeated Measures dialogue box.
13. Click on the button and you will be presented with the Repeated Measures: Save dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

14. Select Studentized from the –Residuals– area, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

15. Click on the button. You will be returned to the Repeated Measures dialogue box.
16. Click on the button and you will be presented with the Repeated Measures: Options dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

17. In the –Display– area, tick the Descriptive statistics and Estimates of effect size checkboxes, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

18. Click on the button. You will be returned to the Repeated Measures dialogue box.
19. Click on the button.

Now that you have run the General Linear Model > Repeated Measures... procedure to carry out a two-way repeated measures ANOVA, go to the Interpreting Results section. You can ignore the section below, which shows you how to carry out a two-way repeated measures ANOVA if you have SPSS Statistics version 24 or earlier.

Join the 10,000s of students, academics and professionals who rely on Laerd Statistics.
##### SPSS Statistics version 24 and earlier
1. Click Analyze > General Linear Model > Repeated Measures... on the top menu, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

You will be presented with the Repeated Measures Define Factor(s) dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

2. In the Within-Subject Factor Name: box, replace "factor1" with the name of your first within-subjects factor. In this example, replace it with the name "treatment", as this reflects the first within-subjects factor, treatment. Enter into the Number of Levels: box the number of treatments (i.e., the number of levels of the within-subjects factor). In this case, enter "2", which represents the control and intervention trials.

Note: It does not matter which within-subjects factor is entered first.

Published with written permission from SPSS Statistics, IBM Corporation.

Click on the button and you will get the following screen:

Published with written permission from SPSS Statistics, IBM Corporation.

3. Enter a name for the second within-subjects factor into the Within-Subject Factor Name: box. In this example, enter "time", which represents the variable time. Enter into the Number of Levels: box the number of time points (i.e., the number of levels of the within-subject factor). In this case, enter "3", which represents the beginning, midway and end time points. Then, click on the button. You will end up with the screen below:

Published with written permission from SPSS Statistics, IBM Corporation.

4. Click on the button and you will be presented with the Repeated Measures dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

5. Transfer all the variables into the Within-Subjects Variables (treatment,time): box by highlighting all the variables (clicking on them whilst holding down the shift-key) in the left-hand box and clicking on the top button. You will end up with the following screen:

Note: The bracketed information – i.e., (treatment,time) – tells you how the variables should be entered. So, for example, (1,3) means group one of treatment (intervention) and group 3 of time (post) which is represented by the variable int_3.

Published with written permission from SPSS Statistics, IBM Corporation.

6. Click on the button and you will be presented with the Repeated Measures: Profile Plots dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

7. Transfer treatment from the Factors: box to the Separate Lines: box and time into the Horizontal Axis: box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

Note: This particular setup works well for this example. However, which within-subjects factor takes the role of the horizontal axis and which the separate lines for your study is up to you (i.e., whatever makes the most sense to you).

8. Click on the button and this will add this plot, labelled "time*treatment", into the Plots: box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

9. Click on the button. You will be returned to the Repeated Measures dialogue box.
10. Click on the button and you will be presented with the Repeated Measures: Save dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

11. Select Studentized from the –Residuals– area, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

12. Click on the button. You will be returned to the Repeated Measures dialogue box.
13. Click on the button and you will be presented with the Repeated Measures: Options dialogue box, as shown below:

Published with written permission from SPSS Statistics, IBM Corporation.

14. Transfer treatment, time and treatment*time from the Factor(s) and Factor Interactions: box to the Display Means For: box by highlighting them and clicking on the button. This will activate the Compare main effects checkbox (i.e., it will no longer be grayed out). Tick this checkbox and select from the drop-down menu under Confidence interval adjustment:. Then, in the –Display– area, tick the Descriptive statistics and Estimates of effect size checkboxes. After you have done all this, you will be presented with the following screen:

Published with written permission from SPSS Statistics, IBM Corporation.

15. Click on the button. You will be returned to the Repeated Measures dialogue box.
16. Click on the button. This will generate the output.

## Analysing the Output from a Two-Way Repeated Measures ANOVA

The output generated by SPSS Statistics is quite extensive and can provide a lot of information about your analysis. However, if there was not a statistically significant interaction between your two factors on the dependent variable, you will need to carry out some additional steps in SPSS Statistics. Below we briefly explain the main steps that you will need to follow to interpret your two-way repeated measures ANOVA results, and where required, perform additional analysis in SPSS Statistics. If you want to be taken through all these sections step-by-step, together with the relevant SPSS Statistics output, we do this in our enhanced two-way repeated measures ANOVA guide. You can learn more about our enhanced content in general on our Features: Overview page. First, take a look through these steps:

• Step #1: You need to interpret the results from your assumption tests to make sure that you can use a two-way repeated measures ANOVA to analyse your data. This includes analysing: (a) the studentized residuals to check for significant outliers (Assumption #3); (b) the residuals for normality, as well as carrying out Shapiro-Wilk's test of residuals (Assumption #4); and (c) the variances of the differences between all combinations of related groups to check for sphericity (Assumption #5). This SPSS Statistics output will not only determine whether you have to go back to the beginning of the whole two-way repeated measures ANOVA process in order to try and make adjustments to your data so that you can use this test (e.g., by "transforming" your data), but also what SPSS Statistics output you need to interpret later (i.e., based on the results from the Mauchly's tests of sphericity, which is used to test assumption #5).
• Step #2: You need to make an initial judgement of what your data looks like and whether you might expect a statistically significant interaction term. You can do this by interpreting your profile plot. Once you have done this, you can look at the formal statistical test in the Tests of Within-Subjects Effects table in the SPSS Statistics output to determine whether you do indeed have a statistically significant interaction term. Which part of this output your should interpret will depend on whether your data passed the assumptions tests in Step #1 above.

• ### For a statistically significant interaction

• Step #3a: If you have a statistically significant interaction, reporting the main effects within the Tests of Within-Subjects Effects SPSS Statistics output can be misleading. Instead, you need to determine the difference between your groups at each level of each factor. You do this by analysing your data again to determine what are known as simple main effects (i.e., rather than main effects). Since you have already gone through the 16 steps in SPSS Statistics above, this is a very quick procedure in SPSS Statistics. However, you need to do this for both factors. For example, using the back pain example at the beginning of this guide, you would first be interested in testing the simple main effects of your first factor, the "conditions" (i.e., this factor as two groups: the "massage programme" and the "acupuncture programme"). This would involves testing for differences in back pain scores (i.e., your dependent variable) between the two conditions at each group of the second factor, "time" (i.e., you are testing for differences between the two conditions at each of the three time points: "at the beginning of the programme", "midway through the programme" and "at the end of the programme"). You then need to do this all over again, but this time, focusing on the simple main effects of your second factor, "time". After carrying out these simple main effects procedures in SPSS Statistics, you need to interpret the profile plots that are produced, as well as the new SPSS Statistics output in the Mauchly's Test of Sphericity, Tests of Within-Subjects Effects and Pairwise Comparisons tables. You are now in a position to write up all of your results.

• ### If you do not have a statistically significant interaction

• Step #3b: If you do not have a statistically significant interaction, you need to interpret and report the main effects within the Tests of Within-Subjects Effects SPSS Statistics output tables (i.e., rather than calculating simple main effects, which you do when the interaction is statistically significant). You have to interpret the main effects for both factors (i.e., the "conditions" and "time"). In addition, if either of these main effects is statistically significant, you will need to interpret the relevant SPSS Statistics output from your post hoc tests in the Pairwise Comparisons table. This will help you to understand where the differences between the groups within your factors lie (e.g., from our back pain example, the differences in back pain between the two "conditions": the "massage programme" and the "acupuncture programme").

If you are unsure how to interpret your two-way repeated measures results, or how to check for the assumptions of the two-way repeated measures ANOVA, carry out transformations using SPSS Statistics, or conduct additional SPSS Statistics procedures to run simple main effects on your data (see Step #3a), we show you how to do this in our enhanced two-way repeated measures ANOVA guide. We also show you how to write up the results from your assumptions tests and two-way repeated measures ANOVA output if you need to report this in a dissertation/thesis, assignment or research report. We do this using the Harvard and APA styles. You can learn more about our enhanced content on our Features: Overview page.

Join the 10,000s of students, academics and professionals who rely on Laerd Statistics.