mean_diff¶
- mean_diff(group1: Any, group2: Any, axis: int = -1, xp=None) ndarray[float] | float[source][source]¶
Calculate the mean difference between two groups.
This function is the default statistic function for time_perm_cluster. It calculates the mean difference between two groups along the specified axis.
- Parameters:
- Returns:
avg1 - avg2 – The mean difference between the two groups.
- Return type:
arrayorfloat
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]]) >>> mean_diff(group1, group2, axis=1) array([ 0., 14.]) >>> mean_diff(group1, group2, axis=0) array([ 0., 30., 0., 5., 0.]) >>> group3 = np.arange(100000, dtype=float).reshape(20000, 5) >>> mean_diff(group3, group1, axis=0) array([49997., 49968., 49999., 49995., 50001.])