Threshold calculation for spatio_temporal_cluster_test()?

  • MNE version: 1.9.0
  • operating system: Ubuntu 24.10

Hello everyone. I’m using mne.stats.spatio_temporal_cluster_test() to find differences between two conditions of spectrogram data with shape (n_channels x n_times x n_freqbins x n_observations). In general, my two conditions ldata and rdata sometimes have different numbers of observations. I’m setting up and running the test as below:

threshold = scipy.stats.f.ppf(1 - self.alpha, dfn=1, dfd=ldata.shape[-1] - 2)
Fs, clusters, pvals, H0s = mne.stats.spatio_temporal_cluster_test(
    (np.swapaxes(ldata, 0, -1), np.swapaxes(rdata, 0, -1)),
    n_jobs=-1, n_permutations=1000, out_type="mask",
    tail=1, threshold=threshold
)

My questions at the moment are:

  • Should I be using a single-tailed test here with tail=1 and 1 - self.alpha for the quantile?
  • For num_conditions = 2, is dfn=n_conditions - 1 = 1 correct?
  • For num_observations = ldata.shape[-1], is dfd=num_observations - num_conditions still correct? Or should I add the number of observations across my two conditions, num_observations = ldata.shape[-1] + rdata.shape[-1]?

Thank you,
Eli