Within-subject Cluster-based Permutation

Hi MNE community,

I have a quick question concerning the non-parametric cluster-based permutation tests for data in the time-frequency domain.

I have looked at the many tutorials but I struggle to find any information on what should differ when having a within-subject vs a between-subject design. Mainly, I am not sure which tutorial refers to a within-subject experimental design (my main interest) when comparing N subjects across two conditions in time-frequency-sensor space. In my case, I have two datasets (the conditions), of size nSubjectsnFreqsnTimes*nSensors, and would like to find significant clusters when comparing the two.

Could anyone explain whether this Permutation statistic for time-frequencies tutorial is appropriate and why (or why not)?


Thank you in advance and apologies if this is a basic question.

Hello Giuseppe,

I had basically the same question some time ago, as I am also interested in a within subjects design with 2 conditions and I have nSubsxFreqsxTimesxSensor arrays.
I think the topic on my question answers a lot of your questions:

The tricky part I encountered after running the permutation test was how to plot the 3D output (freqs, time, channels). I am happy to help with that (I got the code idea from Sebastian Speer, so credits to him).

Best of luck with your analysis,


1 Like

Hi @CarinaFo

thank you for your reply and the link to your issue. I have looked online and within the forum but have not come across yours.

May I ask, does this mean that is the stat_fun that defines the design? What is your suggestion for a within-subject design?

Regarding plotting the 3D output, I have for now followed the tutorial, masking the non-significant areas in the average time-freq images of significant clusters. Is there a better idea?



Happy that I could help.

To my understanding the stat_fun defines the statistical test that you use for the permuation test, you can define your own. I just had 2 conditions, so for me a paired_ttest is sufficient for a within design (as you can see in the discussion to my question).
Yes, I plot the significant electrodes and then a time-frequency plot where I play around with the alpha parameter to highlight significant cluster. Did you define the adjacency between all 3 dimensions?




I have only one condition, I believe. I will look into which of the statistics function I will need to match my design.

Yes, I did define the adjacency matrix across the ion time-frequency-sensor space. I used and loaded the FieldTrip Biosemi64 standard, which happens to be exactly the same type of EEG system I used to collect data.

Thank you so much for your help and link to your previous questions. Extremely helpful.