Summary Table for Cluster Permutation?

MacOS 13.2.1
MNE 1.6.0


My question regards spatio-temporal cluster permutations for EEG data. There are two within-subject paradigms, which have both been completed by the same sample. It contains 18 subjects and one paradigm with 2 conditions and another, separate one with 3 conditions. The focus is on sensor data (ERP analysis).

For the 2 conditions, I have used the difference to run a spatio_temporal_cluster_1samp_test, following this tutorial:

Statistical Analysis of ERP Data — Neural Data Science in Python

(Permutation t-Test for Multiple comparisons)


n_perm = 5e4

t_obs, clusters, cluster_pv, H0 = spatio_temporal_cluster_1samp_test( 

In case of the 3 conditions; I have run another permutation using an F-statistic following this tutorial:

Spatiotemporal permutation F-test on full sensor data — MNE 1.8.0.dev32+g7a4706b07 documentation


n_conditions = len(conditions)
n_observations = X1.shape[0]
dfn = n_conditions - 1
dfd = n_observations - n_conditions

# thresh
f_thresh = scipy.stats.f.ppf(1 - alpha_cluster_forming, dfn=dfn, dfd=dfd)

# cluster based permutation analysis
F_obs, clusters, p_values, H0 = spatio_temporal_cluster_test(
    [X1, X2, X3],

This all worked just fine, however I am stuck on how to get a summary output for the statistics. I am looking to have a tables of results that include respectively the t/F statistic, cluster start and end time, p values, sensors, conditions, etc per cluster. So far, I have not found a function / an example of this in the tutorials or documentation. I managed to get the F_obs/t_obs, clusters, p_values, H0 into dictionaries and pandas dataframes, but that is not even close to the summary output I am looking for.

Here are examples of what I am trying to achieve, but for sensor analysis:

As I am still quite new to this, I wanted to ask if anyone can help me out?


no function creates such an output yet. So I guess your approach of creating a dataframe with the respective columns or a dictionary seems reasonable. If you share your code snippet, I can help you with further formatting. The cluster variable from the output contains the time indices for the each cluster (and frequencies or channels depending on your input data dimensions).




thank you for your answer.

My input data has a 18 x 615 x 32 shape, which represents observations x time x channels.

Here is how I tried to organise it so far:

# first tried a dictionary 
cluster_dict = dict(T_obs=t_obs, clusters=clusters,
                    cluster_p_values=cluster_pv, H0=H0)

# then opted for a data frame
d = pd.DataFrame([k, *v] for k, v in cluster_dict.items()).T
headers = d.iloc[0]
cluster_stats = pd.DataFrame(d.values[1:], columns=headers)

I subsequently used the same for the second permutation with 3 conditions, however the F_obs variable is obviously different in shape ((p[, q], n_vertices)) compared to the t_obs ([n_tests] following the documentation).

Kind regards


The output should be similar according to the documentation, instead of t values you obtain f values from an f-test, but the shape of t_obs and f_obs should be the same.
You can also use the permutation_cluster_1samp_test function and the
permutation_cluster_test function as you are using sensor data and not source data, right?

Hope this helps?