[FieldTrip] 3x2 cluster-based permutation and random seed

Mikkel Christoffer Vinding mvi at psy.ku.dk
Mon Jul 7 12:05:55 CEST 2025


Dear Annie


I think you are on the right track! If you are looking for the interaction effect between 2 group factors and 2 within group factors, calculating the difference wave between the two conditions within group and using the difference waves in a t-test will is conceptually the same as the interaction in a 2x2 ANOVA.


One thing is that it looks like you are creating the difference wave on the grand averages (assuming GA12, GA11, etc. stands for grand average, i.e., the group averages). You should do this on individual participant level data instead:: subtract condition A from condition B for each participant. The following step with ft_freqstatistics should also include the individual level data, not the group-level average data.




For expanding to a 3x2 mixed ANOVA design




________________________________
Fra: fieldtrip <fieldtrip-bounces at science.ru.nl> på vegne af Annie Menart via fieldtrip <fieldtrip at science.ru.nl>
Sendt: 2. juli 2025 20:49:58
Til: fieldtrip at science.ru.nl
Cc: Annie Menart
Emne: [FieldTrip] 3x2 cluster-based permutation and random seed

Dear Fieldtrippers,

We are currently adapting a 2 group by 2 condition cluster-based permutation to be a 3 group by 2 condition cluster-based permutation. Following the documentation, we are subtracting the conditions to test the interaction. Does the code below look like a valid way to do this? It's running correctly and we don't get errors, but we wanted to make sure, since it differed from the setup of the K-by-L example.

Example code from the 2x2 documentation :

cfg = [];
cfg.parameter = 'powspctrm';
cfg.operation = 'subtract';
GAdiff11_12 = ft_math(cfg, GA11, GA12);
GAdiff21_22 = ft_math(cfg, GA21, GA22);

...

[stat] = ft_freqstatistics(cfg, GAdiff11_12, GAdiff21_22);

Our adaptation of the example code to be a 3x2 interaction:

cfg = [];
cfg.parameter = 'powspctrm';
cfg.operation = 'subtract';
GAdiff11_12 = ft_math(cfg, GA11, GA12);
GAdiff21_22 = ft_math(cfg, GA21, GA22);

GAdiff31_32 = ft_math(cfg, GA31, GA32);

...

[stat] = ft_freqstatistics(cfg, GAdiff11_12, GAdiff21_22, GAdiff31_32);


Secondly, for cluster-based permutations (ft_freqstatistics), can you set the seed using cfg.randomseed? In the documentation, we've seen it used for ft_componentanalysis, but we weren't sure if it also worked for ft_freqstatistics. We have it running with no errors, but wanted to make sure since we didn't see the parameter cfg.randomseed used directly in ft_freqstatistics. If not, is there a way to set the seed?

Best,
Annie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250707/f2d553c7/attachment.htm>


More information about the fieldtrip mailing list