One sample/paired sample permutation test based on a t-statistic.
This function can perform the test on one variable or simultaneously on multiple variables. When applying the test to multiple variables, the “tmax” method is used for adjusting the p-values of each variable for multiple comparisons. Like Bonferroni correction, this method adjusts p-values in a way that controls the family-wise error rate. However, the permutation method will be more powerful than Bonferroni correction when different variables in the test are correlated (see ).
array, shape (n_samples, n_tests)
Samples (observations) by number of tests (variables).
Number of permutations. If n_permutations is ‘all’ all possible permutations are tested. It’s the exact test, that can be untractable when the number of samples is big (e.g. > 20). If n_permutations >= 2**n_samples then the exact test is performed.
If tail is 1, the alternative hypothesis is that the mean of the data is greater than 0 (upper tailed test). If tail is 0, the alternative hypothesis is that the mean of the data is different than 0 (two tailed test). If tail is -1, the alternative hypothesis is that the mean of the data is less than 0 (lower tailed test).
The number of jobs to run in parallel. If
-1, it is set
to the number of CPU cores. Requires the
None (default) is a marker for ‘unset’ that will be interpreted
n_jobs=1 (sequential execution) unless the call is performed under
joblib.parallel_backend() context manager that sets another
int| instance of
A seed for the NumPy random number generator (RNG). If
the seed will be obtained from the operating system
RandomState for details), meaning it will most
likely produce different output every time this function or method is run.
To achieve reproducible results, pass a value here to explicitly initialize
the RNG with a defined state.
n_permutations >= 2 ** (n_samples - (tail == 0)),
seed will be ignored since an exact test
(full permutation test) will be performed.