psiaudio.stats module

ht2_2samp(x1, x2)

Computes the two-sample Hotelling T^2 statistic representing the distance between x1 and x2.

Implements Srivastava (2007), Multivariate Theory for Analyzing High Dimensional Data.

Parameters:
  • x1 (2D array or DataFrame) – Rows are individual trials.

  • x2 ({None, 2D array or DataFrame}) – Rows are individual trials.

Returns:

result – Named tuple (T2, F, p, df) where T2 is the T^2 statistic, F is the F value, p is the p-value as computed under the assumption that the F-statistic follows the chi-square distribution, and df is the degrees of freedom.

Return type:

namedtuple

ht2_2samp_result

alias of HT2_2_samp_result

ht2_individual(train, test=None)

Computes the Hotelling T^2 statistic for each individual trial in the test set against the distribution in the train set.

Parameters:
  • train (2D array or DataFrame) – Rows are individual trials. This is the reference dataset.

  • test ({None, 2D array or DataFrame}) – Rows are individual trials. If None, then the train set is used as the test set.

Returns:

t2 – T^2 statistic for each row in the test set.

Return type:

1D array