Skip to content

Repeated Measure ANOVA

Cyril Pernet edited this page Nov 1, 2022 · 15 revisions

Analyzing a factorial design

The example taken is from Wakeman and Henson (2015) - these are the data we process during the EEGLAB workshop and in the tutorial. In short, it's a 3*3 design for famous, unfamiliar, scrambled faces (factor 1) seen the 1st time, or repeated immediately or later (2nd factor).

1st level analysis

For each subject, always go for a simple design with all your conditions - that is here 9 conditions for 3*3 design. This is conceptually the same as computing 9 averages from which, across subjects, we compute the repeated measure ANOVA.

2nd level analysis

One repeated factor

Let's do a simple 1-factor design, comparing famous, unfamiliar, and scrambled faces. At the 1st level, we created contrasts pooling repetition levels (either via the LIMOEEG batch or EEGLAB study design).

Making the design

the GUI asks a series of questions How many independent groups?: here 1 (we have 1 group) Enter repeated factors: here 3 (we indicate 1 factor of 3 levels) con or beta: for this data we use con

Results

Rep_ANOVA_Factor_1.mat contains all the F and p values. This can be seen using the image all result button.

Two factors

For this dataset, the true design is 2 factors: familiarity and repetition

Making the design

the GUI asks a series of questions How many independent groups?: here 1 (we have 1 group) Enter repeated factors: here [3 3] (we indicate 2 factors, each with 3 levels) con or betas: for this data we use betas

when selecting Betas, it will ask which one to use, making reference to the 1st level design matrix (ie which condition is which and in which order, you got to know that - EEGLAB study design also have this info on display).

Results

Rep_ANOVA_Factor_1.mat is the familiarity effect, Rep_ANOVA_Factor_2.mat is the repetition effect and Rep_ANOVA_Factor_3.mat is the interaction. This information is available in LIMO.design.effects.

More factors

The only limit to the number of factors is your number of subjects, as long as you have more subjects than the total number of cells (product of factor levels) then LIMOEEG can compute it.

Group * repeated measures

If you have more than one group, all of the above applies. LIMO MEEG will also compute the group effect and all the interaction group by factors.

Post-hoc Contrasts

When you have many factors and groups, post-hoc contrasts are needed to understand and specify effects. Of course, you should also plot the effects to see and show that directly.

You can already see what has been computed in LIMO.design.C, which are the contrasts used to compute the effects (with the names in LIMO.design.effects). Let's go back to our 3 (faces) *3 (repetition) design. Say you want to know if famous and unfamiliar faces have a stronger repetition effect than unfamiliar faces (i.e. that would be your guess from an interaction effect, but this needs to be tested, the interaction only says there is a difference). Assuming a design as [famous faces 1st repetition, famous faces 2nd repetition, famous faces 3rd repetition, scrambled faces 1st repetition, scrambled faces 2nd repetition, scrambled faces 3rd repetition, unfamiliar faces 1st repetition, unfamiliar faces 2nd repetition, unfamiliar faces 3rd repetition] the following contrast would test your hypothesis: [0.5 0 -0.5 -1 0 1 0.5 0 -0.5].

Let's break it down:

  • 1st, we want linear effects for repetitions, for instance for famous faces this would be [1 0 -1 0 0 0 0 0 0]
  • 2nd, we want to add famous and unfamiliar vs. scrambled hence the [0.5 0 -0.5 x x x 0.5 0 -0.5] vs [x x x 1 0 -1 x x x]
  • 3rd, we test famous+unfamiliar > scrambled, i.e. (famous+unfamiliar) - scrambled > 0 so we need to inverse the sign for scrambled (ie. -[1 0 -1] = [-1 0 1])
  • we can now understand the contrast as [1st repetition of (famous+unfamiliar) - scrambled] > [3rd repetition of (famous+unfamiliar) - scrambled] which the same as 1st repetition of (famous+unfamiliar) > 3rd repetition of (famous+unfamiliar) different from 1st repetition of scrambled > 3rd repetition of scrambled

Post-hoc contrasts with group effect

Because limo tools rely on a Hotelling T, the group effect and interactions are obtained by running an ANOVA on marginal means. This means:

  • for a given contrast, the group interaction is computed testing if groups differ for the contrast value (e.g. do group differ on the difference between condition A and B)
  • there is no easy way to test for sub-groups differences (e.g. if you have three groups, but want to see if group 1 differ from 2+3, you have to do another model with 2 groups only)

A note on Hotelling test, computations and the design matrix

The statistical test

The ANOVA uses a Hotelling T^2 test. Since in a repeated measure design, we have multiple observations (Y), the data are multivariate by nature. It is thus natural to use a multivariate procedure. The advantage of Hotelling T^2 over a Fisher ANOVA model is that it accounts for the covariance between measures and thus does not need post-hoc adjustment for sphericity.

Any test, main effect, interactions, or contrasts, is 'just' the averaging over subjects of some repetition and computing the Mahalanobis distance between those means, and then adjusting for degrees of freedom. The pooling in the model is stored in LIMO.design.C and additional contrasts are stored in LIMO.contrasts. For the model, the corresponding df and dfe are stored in LIMO.design.df and LIMO-design.dfe. Degrees of freedom of an effect is defined by the rank of the contrast matrix and the degree of freedom the error if n-df (n is the number of subjects for the means, not the number of observations, since this is a multivariate test). Note that, if you did not interpolate channels, you can end-up with different df and dfe (substituted by NaN) and this is ok as the bootstrap will also include those.

Computations

When there are more than 2 measures, there is no need to test all combinations. For instance, a factor with 3 levels A, B, C can be tested with a contrast F [1 -1 0; 1 0 -1]. This means that while this is useful to do an 'image all' in the results to see where there is an effect, the plots are pretty useless (you can still do it though). The best is to use LIMOEEG to use the 'basic stats': make a central tendency (e.g. mean of betas/con) per condition and visualize them to show the results, along with the data (e.g. mean of data).

The design matrix

The design matrix shows only the total number of cells, ie a design with 6 measures or the 2*3 look exactly the same. This is because the data are organized in cells and pooled according to the factors.

Clone this wiki locally