Permutation cluster test with paired samples

Dear MNE users,

I have a question on cluster-based permutation testing. I have a dataset with 31 participants, each participant performed two tasks and I want to compare the theta power time course between these two tasks at the source level. I used the function source_band_induced_power() to extract the time courses of theta from the whole brain sources.

Now, I want to compare the two tasks. According to this tutorial (Permutation t-test on source data with spatio-temporal clustering โ€” MNE 0.22.0 documentation) I should compute the difference between the two conditions, and then perform a cluster-based permutation. I tried to follow this pipeline and the code runs.

However, I wonder whether this is actually comparing the two conditions in the way I am interested in. Namely, given that the input matrix X is n_subj * n_timepoints * n_vert, I think the function permutes across time and space.

What I would want to achieve is for each permutation to randomly swap the condition to which the time*space matrix is assigned, without affecting the dependency between time and space. I think this would be a more fair test for the differences between my two tasks.

I am not being able to implement this approach. I think I should use a stat_fun within the permutation_cluster_test analogous to scipy.stats.ttest_rel, but I am not sure how to do this and if it makes sense.

Thanks in advance for any help!
Best,

Silvia

Iโ€™m pretty sure that the function is already doing what you want it to do. It does not permute across time and space; it clusters across time and space, as controlled by the adjacency and max_step parameters (which together determine which times are considered temporally adjacent, and which vertices are considered spatially adjacent).

Analyzing your data with the default stat_fun is already effectively the same as using scipy.stats.ttest_rel (which does the subtraction of condition A from condition B for you; here youโ€™ve done the subtraction already so comparing the result against 0 using ttest_1samp is equivalent).

2 Likes

Hi Dan,

thanks a lot for your clear reply!
I have a follow up question: what is actually being permuted? Is it the sign of the observations? (by observation I mean for each subject the difference value between the two conditions).
I tried to figure it out in the source code but it is too advanced for me.

Thanks!
Silvia

yes, exactly. The permutation happens by sign-flips. FYI the relevant part of the code is around here: mne-python/cluster_level.py at baaf9e33f2b54f6a40454a8aa146577bde1d6f58 ยท mne-tools/mne-python ยท GitHub

1 Like