# [FieldTrip] repeated measures ANOVA (statfun_depsamplesF): dfdenom problems

Tim Kietzmann tkietzma at uos.de
Thu Oct 31 16:34:10 CET 2013

```Professor Maris asked me to repost this email to the list, so his response gets archived and accessible to everyone.

Best regards and thanks
Tim

%%

Dear fieldtrip discussion list,

We have recently run into problems using the implementation of a repeated measures ANOVA in statfun_depsamplesF.m. In our experiment, we have recorded data of 16 subjects, and the factor of the repeated-measures ANOVA has 37 levels (admittedly quite a few but that's just how it is).

Now if I am not mistaken, then for a repeated measures ANOVA, the degrees of freedom in above case should be: df1 = 36 and df2 = 540 (this is in line with the results of SPSS, too). However, the statfun_depsamplesF.m function seems to compute dfdenom as nunits - ncontrasts (nunits is the number of subjects, and ncontrasts is nlevels-1). This of course leads to a different value as compared to SPSS and what I found in the literature, in which dfdenom is computed as (K-1)*(n-1), so in the current case as (nunits-1)*ncontrasts.

For a one-factor repeated measures ANOVA, I could so far not find a principled reason why the number of levels should not exceed the number of subjects (which is the error message we get). In fact, SPSS works just fine in above scenario. Could someone please explain the logic behind the dfdenom computation in fieldtrip? Could it be that there is an error in how the degrees of freedom are computed, or am I missing something obvious here? For a MANOVA, the story would be different of course.

I should add that we are currently interfacing fieldtrip from eeglab and get above error only if we choose the nonparametric fieldtrip statistics (with cluster correction), but the parametric tests implemented in eeglab work just fine.

Thank you very much for your help, I am looking forward to your responses
Tim

```