Jeromy Anglim's Blog: Psychology and Statistics


Wednesday, September 2, 2009

Repeated Measures Experiments with Many trials in SPSS (PASW)

I was recently talking to a researcher who was in the process of analysing experimental data based on a 2 x 2 x 2 x 4 repeated measures design. Each combination of the levels of the repeated measures factors involved five trials. The dependent variable was reaction time. The researcher had their data laid out in a one person per participant format (wide format). I had the following advice for the researcher:

Data Format:
Create a long format data file called “trials” where each row is the combination of one participant and one trial. And have a separate data file called “subjects” that contains one row per participant and includes data on participants that is constant throughout the experiment (e.g., gender, age, personality measures, etc.).



In order to run a standard repeated measures ANOVA in SPSS (PASW) using Analyze - GLM - Repeated Measures, you need to have data arranged in wide format, where each row is a participant and variables represent cell means in the repeated measures ANOVA. The following procedure can take you from a trials-dataset in long format to a participants-dataset in wide format.

  1. Aggregate the trials-dataset: mean of RT; break on participant ID, and any factors that you plan to model in the subsequent repeated measures ANOVA. This will create a cells-dataset with one row representing a combination of a participant and a cell mean RT.
  2. Restructure this cells-dataset from long format to wide format: where each row in the new data file is a participant and each cell by RT combination is a new. You can at this point run your standard SPSS (PASW) repeated measures ANOVA on this data.
  3. Optionally at this point you could merge this new participants-dataset into your main participant data file if you needed.

For a discussion of aggregating, restructuring, and merging with links to step by step guides, see HERE:

Individual Level Analysis:
A further benefit of the long format data file is that you can perform individual level analyses. Thus, you can examine the effects of the repeated measures factors using a between subjects ANOVA or a regression for each individual separately. In order to repeat the analysis for each individual in SPSS, check out the split file option. Here’s some examples of using split file: EXAMPLE 1 EXAMPLE 2

The long format is also a way of launching into the multilevel modelling literature, which represents another way of examining repeated measures effects. This is less necessary when you have a balanced design as is typical in repeated measures experiments. Nonetheless, the multilevel modelling framework has particular benefits once familiarity is attained. SPSS (PASW) provides the Analyze - Linear - Mixed Tool
See: A nice Tutorial ; More Information

Data Cleaning:
One of the things with modelling reaction times is that outliers can cause problems. Standard rules for outlier deletion can suggest deleting data above or below a given threshold. Some discussion can be found here in this article, and some SPSS scripts here.

The challenge in the present circumstances is to avoid biasing estimates of experimental effects as a result of any outlier deletion strategy. In particular, this can arise when some cells in the design are more likely to have slower reaction times either because of a distributional shift or a greater probability of extreme times.

One simple strategy for detecting outliers can be used when the data is in long format. This involves first running a model (e.g., a univariate ANOVA, you may want to remove interaction effects – under the model button) that includes the factors that should predict reaction time (make sure to include ID as a factor), and select save standardised residuals, then filter out trials with standardised residuals above or below a certain threshold (e.g., + or – 2.5 or 3). The key is to have a model with enough values in each cell to differentiate real data from outliers. If you also save predicted values you can check that there are at least 15 or 20 predictions that are the same.

Another check can be to take the median reaction time when aggregating data in order to check that it is consistent with the results regarding mean reaction time. The median is more robust than the mean. However, it also carries less information. Thus, there is a trade-off between robustness and maximising available information.