Possible bug in permutation function

Hi all,

Thank you to all the developers/contributors for MNE. I think I have identified a bug in the function permutation_t_test.

  • MNE version: e.g. 0.22.0
  • operating system: Windows 10

The issue is that the p-value produced does not appear to depend on whether a one- or two-tailed test is requested. Unless I am confused, this is not the expected behaviour. Minimal example:

import numpy as np
import mne.stats as stats

testData = np.atleast_2d(np.arange(5)).T

for thisTail in [0, 1]:
    _, p_values, _ = stats.permutation_t_test(testData, tail=thisTail)
    print('p-value: {}'.format(p_values[0]))

Many thanks for any thoughts.
Josh

Issue opened on GitHub: Permutation test number of tails · Issue #11511 · mne-tools/mne-python · GitHub