# Collapsing data for repeated measures ANOVA?

Data

An experiment was run with 40 subjects. 20 subjects are in condition 1 and 20 in condition 2. Over the course of the experiment, subjects went through 60 trials. 20 trials with stimuli of type A, 20 with stimuli of type B and 20 trials with stimuli of type C. In each trial, 6 scores are measured (secondwise).

Image

Fig. Two plots, one for condition 1 and one for condition 2. Secondwise scores are plotted collapsed over subjects (20 per condition) but split according to trial type (A/B/C). Errorbars show SEM.

Are scores statistically different between condition 1 and condition 2?

Approach so far: Collapsed scores over type of trial per subject, so that there are 3*6 measurement points per subject instead of 3*20*6. Turned data into wide format and ran repeated measures ANOVA in SPSS. Only main effect of second is significant. Looking at the graphs, however, the blue one seems very different between the two conditions.

Question

Did I throw away information by collapsing data before running the ANOVA?

• That would seem to be a reasonable explanation. Commented May 6, 2012 at 16:51

Yes you threw away information but you had to because that's how you run ANOVA. Your multiple measures of a condition within a subject only serve to better estimate the mean of that condition for the subject under ANOVA.

You have, from your description, at least a 2 between x 3 within ANOVA but I'm unclear on a point. Are you're six scores "secondwise" 6 additional conditions? What are they? Regardless, you need to add the between factor. It seems apparent from your graph you have a between x within interaction of some sort.

(and why the heck are you running the analyses in SPSS and graphing them in R?)

• In each row I have my data as follows: subject, condition, typeA_sec1, typeA_sec2, ... typeC_sec6 (=9 scores). I specify condition as between and both - type (3 levels) and second (6 levels) - as within. The secondwise scores are not conditions but measurement points from a baseline state over six seconds during stimulus presentation. At the moment, I only get a main effect of type (A/B/C), which would suggest that both conditions don't differ, correct? (I'm running my analysis in SPSS as this is - sadly - how they teach us in class. I will be trying out the ez package for R.) Commented May 6, 2012 at 17:07
• Well, collapsing across trial you've done nothing wrong, if that was the implication of your question. You're supposed to lose that trial information in the ANOVA. If this is an educational exercise then you're doing it right. If it was supposed to be you just looking for things in your data then you really probably need to switch to multi-level modelling. The ez package facilitates that too.
– John
Commented May 6, 2012 at 17:10
• It's more than just an exercise, I would like to find out about the difference between conditions. Unfortunately, mixed models were not covered in classes. Would I be on the right track turning my data in long format, then running ezMixed with condition as random factor and type + second as fixed ones? Commented May 6, 2012 at 17:23
• Subject would be the random factor and all of your conditions (2x3x6) would be fixed. I'd also switch the time condition to a continuous predictor (and take the log). Especially if, as I suspect, those graphs you posted look quite linear with the x-axis as log.
– John
Commented May 6, 2012 at 19:27
• As developer of ez, I strongly suggest that you use the dev version of ez (github.com/mike-lawrence/ez) which has a much enhanced version of ezMixed. Commented May 8, 2012 at 11:00