window_averaged_shuffle¶
- window_averaged_shuffle(sig1: ~numpy.ndarray, sig2: ~numpy.ndarray, n_perm: int = 100000, tails: int = 1, obs_axis: int = 0, window_axis: int = -1, stat_func: callable = <function ttest>, seed: int = None) ndarray[bool][source][source]¶
Calculate the window averaged shuffle distribution.
Essentially a wrapper for: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.permutatio n_test.html#scipy.stats.permutation_test
- Parameters:
sig1 (
array,shape (trials,...,time)) – The first group of observations.sig2 (
array,shape (trials,...,time)) – The second group of observations.n_perm (
int, optional) – The number of permutations to perform. Default is 1000.tails (
int, optional) – The number of tails to use for the p-value. Default is 1.obs_axis (
int, optional) – The axis along which to calculate the statistic function. Default is 0.window_axis (
int, optional) – The axis along which to calculate the window average. Default is -1.stat_func (
callable, optional) – The statistic function to use. Default is mean_diff.seed (
int, optional) – The random seed to use for the permutation test. Default is None.
- Returns:
shuffle_dist – The shuffle distribution.
- Return type:
np.ndarray
Examples
>>> import numpy as np >>> seed = 42; rng = np.random.default_rng(seed) >>> sig1 = np.array([[0,1,1,2,2,2.5,3,3,3,2.5,2,2,1,1,0] ... for _ in range(50)]) >>> sig2 = rng.random((100, 15)) * 6 >>> float(window_averaged_shuffle(sig1, sig2, n_perm=100000, seed=seed ... )) 9.99...