nadeau_bengio_ttest#

hidimstat.statistical_tools.nadeau_bengio_ttest(a, popmean, test_frac, axis=0, alternative='greater')[source]#

One-sample t-test with Nadeau & Bengio variance correction.

Simplification of scipy/scipy Remove all the check and the management of NaN and empty array.

This is a modification of scipy.stats.ttest_1samp that applies the Nadeau and Bengio[1] correction to the variance estimate to account for dependence between repeated cross-validation estimates.

Parameters:
aarray_like

Sample data. The axis specified by axis is the sample (observation) axis.

popmeanscalar

The population mean to test against.

test_fracfloat

Fraction of the data used for testing (test set size / total samples). Used by the Nadeau and Bengio[1] correction when adjusting the sample variance.

axisint or None, default=0

Axis along which to compute the test. Default is 0. If None, the input array is flattened.

alternative{‘two-sided’, ‘greater’, ‘less’}, optional

Defines the alternative hypothesis. Default is ‘greater’.

Returns:
NBTtestResult

Named tuple with fields: statistic, pvalue. Both are computed using the Nadeau & Bengio corrected standard error.

Notes

The variance is corrected using the factor implemented here: corrected_var = var * (1 / n + test_frac) where n is the number of repeated evaluations along axis.

This function does not support masked arrays and only accepts numpy arrays.

References