mne.stats.permutation_cluster_test¶

mne.stats.
permutation_cluster_test
(X, threshold=None, n_permutations=1024, tail=0, stat_fun=None, connectivity=None, n_jobs=1, seed=None, max_step=1, exclude=None, step_down_p=0, t_power=1, out_type='mask', check_disjoint=False, buffer_size=1000, verbose=None)[source]¶ Clusterlevel statistical permutation test.
For a list of ndarrays of data, e.g. 2d for time series or 3d for timefrequency power values, calculate some statistics corrected for multiple comparisons using permutations and cluster level correction. Each element of the list X contains the data for one group of observations. Randomized data are generated with random partitions of the data.
 Parameters
 X
list
List of ndarrays containing the data. Each element of X contains the samples for one group. First dimension of each element is the number of samples/observations in this group. The other dimensions are for the size of the observations. For example if X = [X1, X2] with X1.shape = (20, 50, 4) and X2.shape = (17, 50, 4) one has 2 groups with respectively 20 and 17 observations in each. Each data point is of shape (50, 4).
 threshold
float
dict
None
If threshold is None, it will choose an Fthreshold equivalent to p < 0.05 for the given number of observations (only valid when using an Fstatistic). If a dict is used, then thresholdfree cluster enhancement (TFCE) will be used, and it must have keys
'start'
and'step'
to specify the integration parameters, see the TFCE example. n_permutations
int
The number of permutations to compute.
 tail1 or 0 or 1 (default = 0)
If tail is 0, the statistic is thresholded on both sides of the distribution. If tail is 1, the statistic is thresholded above threshold. If tail is 1, the statistic is thresholded below threshold, and the values in
threshold
must correspondingly be negative. stat_fun
callable()
None
Function called to calculate statistics, must accept 1darrays as arguments (default None uses
mne.stats.f_oneway()
). connectivity
scipy.sparse.spmatrix
Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. Default is None, i.e, a regular lattice connectivity. Can also be False to assume no connectivity.
 n_jobs
int
The number of jobs to run in parallel (default 1). Requires the joblib package.
 seed
None
int
 instance ofRandomState
If
seed
is anint
, it will be used as a seed forRandomState
. IfNone
, the seed will be obtained from the operating system (seeRandomState
for details). Default isNone
. max_step
int
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.
 excludebool
array
orNone
Mask to apply to the data to exclude certain points from clustering (e.g., medial wall vertices). Should be the same shape as X. If None, no points are excluded.
 step_down_p
float
To perform a stepdowninjumps test, pass a pvalue for clusters to exclude from each successive iteration. Default is zero, perform no stepdown 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.
 t_power
float
Power to raise the statistical values (usually Fvalues) 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.
 out_type
str
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.
 check_disjointbool
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
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more).
 X
 Returns
References
 1
Maris/Oostenveld (2007), “Nonparametric statistical testing of EEG and MEGdata” Journal of Neuroscience Methods, Vol. 164, No. 1., pp. 177190. doi:10.1016/j.jneumeth.2007.03.024.