ttest¶
- ttest(group1: ndarray, group2: ndarray, axis: int, xp=None) ndarray[source][source]¶
Calculate the t-statistic between two groups.
This function is the default statistic function for time_perm_cluster. It calculates the t-statistic between two groups along the specified axis.
- Parameters:
- Returns:
t – The t-statistic between the two groups.
- Return type:
array
Examples
>>> import numpy as np >>> group1 = np.array([[1, 1, 1, 1, 1], [0, 60, 0, 10, 0]]) >>> group2 = np.array([[1, 1, 1, 1, 1], [0, 0, 0, 0, 0]]) >>> ttest(group1, group2, 1) array([ nan, 1.2004901]) >>> ttest(group1, group2, 0) array([0. , 1.01680311, 0. , 1.10431526, 0. ]) >>> import cupy as cp >>> group1 = cp.array([[1, 1, 1, 1, 1], [0, 60, 0, 10, 0]] ... ) >>> group2 = cp.array([[1, 1, 1, 1, 1], [0, 0, 0, 0, 0]]) >>> ttest(group1, group2, 1) array([ nan, 1.2004901])