mne.stats.permutation_cluster_1samp_test¶

mne.stats.
permutation_cluster_1samp_test
(X, threshold=None, n_permutations=1024, tail=0, stat_fun=None, connectivity=None, verbose=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)[source]¶ Nonparametric clusterlevel paired ttest.
 Parameters
 X
array
, shape=(n_samples, p[, q]) Array where the first dimension corresponds to the difference in paired samples (observations) in two conditions.
X[k]
can be a 1D or 2D array (time series or TF image) associated to the kth observation. threshold
float
dict
None
If threshold is None, it will choose a tthreshold equivalent to p < 0.05 for the given number of observations (only valid when using an tstatistic). 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
 ‘all’ The maximum number of permutations to compute. Can be ‘all’ to perform an exact test.
 tail1 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_fun
callable()
None
Function used to compute the statistical map (default None will use
mne.stats.ttest_1samp_no_p()
). connectivity
scipy.sparse.spmatrix
None
False
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. Can also be False to assume no connectivity.
 verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). n_jobs
int
Number of permutations to run in parallel (requires joblib package).
 seed
int
 instance ofRandomState
None
Seed the random number generator for results reproducibility.
 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 tvalues) 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.
 X
 Returns
Notes
From an array of paired observations, e.g. a difference in signal amplitudes or power spectra in two conditions, calculate if the data distributions in the two conditions are significantly different. The procedure uses a cluster analysis with permutation test for calculating corrected pvalues. Randomized data are generated with random sign flips. See [1] for more information.
Because a 1sample ttest on the difference in observations is mathematically equivalent to a paired ttest, internally this function computes a 1sample ttest (by default) and uses sign flipping (always) to perform permutations. This might not be suitable for the case where there is truly a single observation under test; see Statistical inference.
If
n_permutations >= 2 ** (n_samples  (tail == 0))
,n_permutations
andseed
will be ignored since an exact test (full permutation test) will be performed.If no initial clusters are found, i.e., all points in the true distribution are below the threshold, then
clusters
,cluster_pv
, andH0
will all be empty arrays.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.