time_cluster

time_cluster(act: Any, perm: Any, p_val: float = None, tails: int = 1, ignore: tuple | int = None) ndarray[bool][source][source]

Cluster correction for time series data.

  1. Creates an index of all the binary clusters in the active and permuted

    passive data.

  2. For each permutation in the passive data, determine the maximum cluster

    size.

  3. For each cluster in the active data, determine the proportion of

    permutations that have a cluster of the same size or larger.

Parameters:
  • act (array, shape (time)) – The active data.

  • perm (array, shape (n_perm, time)) – The permutation passive data.

  • p_val (float, optional) – The p-value threshold to use for determining significant clusters.

  • tails (int, optional) – The number of tails to use. 1 for one-tailed, 2 for two-tailed.

  • ignore (tuple | int)

Returns:

clusters – The clusters.

Return type:

array, shape (..., time)

Examples

>>> import numpy as np
>>> perm = np.array([[0, 1, 1, 1, 0, 1, 0, 0],
...                  [0, 1, 0, 1, 1, 1, 0, 0],
...                  [0, 1, 1, 0, 1, 1, 0, 0],
...                  [0, 0, 1, 1, 1, 0, 0, 0]])
>>> time_cluster(np.array([0, 1, 1, 1, 1, 1, 0, 0]), perm)
array([0.  , 0.75, 0.75, 0.75, 0.75, 0.75, 0.  , 0.  ])
>>> time_cluster(np.array([0, 0, 1, 1, 1, 0, 0, 0]), perm)
array([0.  , 0.  , 0.25, 0.25, 0.25, 0.  , 0.  , 0.  ])