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:
  • 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 t-statistic. If None, compute the t-statistic over all axes.

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

Examples using ieeg.calc.fast.ttest

Bias simulation in permutation tests

Bias simulation in permutation tests