[FieldTrip] 3x2 cluster-based permutation and random seed
Mikkel Christoffer Vinding
mvi at psy.ku.dk
Mon Jul 7 12:18:59 CEST 2025
Part 2/2 - pressed send to soon :)
For expanding to a 3x2 mixed ANOVA design you can do the same as in a 2x2 by first calculating the difference between conditions for each participant and then subject this to a one-way ANOVA with ft_statfun_indepsamplesF. See similar answer here: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fpipermail%2Ffieldtrip%2F2011-December%2F004557.html&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cb0eb0d6325ea4fb31cce08ddbd3fb55b%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638874803505715872%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=hTjKMgUs0O%2Bg%2BGuL4Pjp3BXc6M45ozcv21HC89LCCeY%3D&reserved=0. I have not used ANOVAs in combination with cluster-based permutation tests, there is some issues I think For example: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ffaq%2Fstats%2Fclusterstats_teststatistic%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cb0eb0d6325ea4fb31cce08ddbd3fb55b%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638874803505755355%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=1Knc%2BGlMJ%2FVvLjYTIkhCWVf9RTyCBWe2kU1DG%2B%2FavoM%3D&reserved=0.
An alternative is to skip the ANOVA and instead do three independent t-tests between the groups (and remember to correct for multiple comparisons). In most cases, people are not really intersted in whether there is a difference in variance between all groups anyway. They only do the ANOVA as a first step to justify doing post-hoc t-tests between select groups and tend to report this as the main results.
Best regards
Mikkel
________________________________
Fra: Mikkel Christoffer Vinding
Sendt: 7. juli 2025 12:05:55
Til: FieldTrip discussion list
Cc: Annie Menart
Emne: Sv: 3x2 cluster-based permutation and random seed
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/9d2078c4/attachment.htm>
More information about the fieldtrip
mailing list