mne.stats.spatio_temporal_cluster_1samp_test(X, threshold=None, n_permutations=1024, tail=0, stat_fun=None, connectivity=None, n_jobs=1, seed=None, max_step=1, spatial_exclude=None, step_down_p=0, t_power=1, out_type='indices', check_disjoint=False, buffer_size=1000, verbose=None)[source]

Non-parametric cluster-level paired t-test for spatio-temporal data.

This function provides a convenient wrapper for data organized in the form (observations x time x space) to use mne.stats.permutation_cluster_1samp_test(), which contains more complete documentation.

Xarray, shape (n_observations, n_times, n_vertices)

Array data of the difference between two conditions.

thresholdfloat | dict | None

If threshold is None, it will choose a t-threshold equivalent to p < 0.05 for the given number of observations (only valid when using an t-statistic). If a dict is used, then threshold-free cluster enhancement (TFCE) will be used, and it must have keys 'start' and 'step' to specify the integration parameters, see the TFCE example.

n_permutationsint | ‘all’

The number of permutations to compute. Can be “all” to perform an exact test.

tail-1 or 0 or 1 (default = 0)

If tail is 1, the statistic is thresholded above threshold. If tail is -1, the statistic is thresholded below threshold. If tail is 0, the statistic is thresholded on both sides of the distribution.

stat_funcallable() | None

Function used to compute the statistical map (default None will use mne.stats.ttest_1samp_no_p()).

connectivityscipy.sparse.spmatrix or None

Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. This matrix must be square with dimension (n_vertices * n_times) or (n_vertices). Default is None, i.e, a regular lattice connectivity. Use square n_vertices matrix for datasets with a large temporal extent to save on memory and computation time.


The number of jobs to run in parallel (default 1). Requires the joblib package.

seedNone | int | instance of RandomState

If seed is an int, it will be used as a seed for RandomState. If None, the seed will be obtained from the operating system (see RandomState for details). Default is None.


When connectivity is a n_vertices x n_vertices matrix, specify the maximum number of steps between vertices along the second dimension (typically time) to be considered connected. This is not used for full or None connectivity matrices.

spatial_excludelist of int or None

List of spatial indices to exclude from clustering.


To perform a step-down-in-jumps test, pass a p-value for clusters to exclude from each successive iteration. Default is zero, perform no step-down test (since no clusters will be smaller than this value). Setting this to a reasonable value, e.g. 0.05, can increase sensitivity but costs computation time.


Power to raise the statistical values (usually t-values) by before summing (sign will be retained). Note that t_power == 0 will give a count of nodes in each cluster, t_power == 1 will weight each node by its statistical score.


For arrays with connectivity, this sets the output format for clusters. If ‘mask’, it will pass back a list of boolean mask arrays. If ‘indices’, it will pass back a list of lists, where each list is the set of vertices in a given cluster. Note that the latter may use far less memory for large datasets.


If True, the connectivity matrix (or list) will be examined to determine of it can be separated into disjoint sets. In some cases (usually with connectivity as a list and many “time” points), this can lead to faster clustering, but results should be identical.

buffer_size: int or None

The statistics will be computed for blocks of variables of size “buffer_size” at a time. This is option significantly reduces the memory requirements when n_jobs > 1 and memory sharing between processes is enabled (see set_cache_dir()), as X will be shared between processes and each process only needs to allocate space for a small block of variables.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

t_obsarray, shape (n_times * n_vertices,)

t-statistic observed for all variables.


List type defined by out_type above.

cluster_pv: array

P-value for each cluster

H0array, shape (n_permutations,)

Max cluster level stats observed under permutation.



Maris/Oostenveld, “Nonparametric statistical testing of EEG- and MEG-data” Journal of Neuroscience Methods, Vol. 164, No. 1., pp. 177-190. doi:10.1016/j.jneumeth.2007.03.024


Smith/Nichols (2009), “Threshold-free cluster enhancement: Addressing problems of smoothing, threshold dependence, and localisation in cluster inference”, NeuroImage 44 (2009) 83-98.

Examples using mne.stats.spatio_temporal_cluster_1samp_test