I am comparing the time-frequency matrices (n_freqs, n_times) between two conditions using mne.stats.spatio_temporal_cluster_1samp_test.

If I understand correctly setting the adjacency parameter to None (default) will connect adjacent neighbors in the time dimension (horizontal). I would like to consider adjacent neighbors in both the frequency (vertical) and time (horizontal) dimensions.

Is there an example I could follow to set up such an adjacency matrix?

Hello @anapesq, if the input data has the shape (observations, times, frequencies), passing adjacency=None should do exactly what you want and form clusters across immediately neighboring time and frequency bins. Clusters are always implicitly formed over neighboring time points.

Thank you for the quick reply and clarification.
Do you know how I would have to set-up the adjacency if I wished to check not only the immediately neighboring time and frequency bins (next cells) but also the bins at a distance of two cells?
Meaning, how could I expand what is considered a neighboring cell.

Do you mean you don’t have “channels” as a dimension? If your data is really just observations * n_freqs * n_times, then mne.stats.spatio_temporal_cluster_1samp_test is the wrong test to choose, see the docstring:

You could have a look at the max_step parameter in the cluster permutation functions. However I haven’t looked into the source code for that, and the parameter description makes me think that:

I re-run the analysis using the suggested mne.stats.permutation_cluster_1samp_test() and the results are the same as when using ‘mne.stats.spatio_temporal_cluster_1samp_test()’. Possibly the later function (which is not the preferred as you suggest) adapts to an input without the channel dimension.