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:
  • group1 (array, shape (..., time)) – The first group of observations.

  • group2 (array, shape (..., time)) – The second group of observations.

  • axis (int or tuple of ints, optional) – The axis or axes along which to compute the mean difference. If None, compute the mean difference over all axes.

Returns:

avg1 - avg2 – The mean difference between the two groups.

Return type:

array or float

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.])

Examples using ieeg.calc.fast.mean_diff

Time Permutation Cluster Statistics

Time Permutation Cluster Statistics