Directional hypotheses#
One- and two-tailed inference#
For t statistics the alternative hypothesis can have a direction. It is specified using:
t.inference( alpha, dirn=0 )
dirn=0(default) specifies a two-tailed test. The test statistic is thresholded at \(\pm z_c\) , where \(z_c\) is the height that the maximum of \(|t|\) exceeds with probability \(\alpha\).dirn=1specifies a one-tailed test in the positive direction. Only excursions above \(+z_c\) are considered. This threshold is lower than the two-tailed threshold.dirn=-1specifies a one-tailed test in the negative direction. Only excursions below \(-z_c\) are considered. The critical thresholdzcis the same positive value fordirn=1anddirn=-1. Fordirn=-1it is applied at \(-z_c\).zmaxis then reported as a positive magnitude (the negative of the minimum test statistic value) so thatzmax > zcmeans rejection in both cases.
The sign convention follows the order of the arguments: ttest2( yA, yB ) is positive where yA exceeds yB. The same is true for ttest_paired( yA, yB ). When selecting dirn=1 the test becomes more sensitive in the positive direction but cannot detect effects in the negative direction.
The inference direction is part of the hypothesis and must therefore be chosen before the data are examined and ideally before the experiment is conducted. Looking at the data and then selecting a direction is biased and must be avoided. Before the experiment, if you are uncertain regarding the specific direction of an effect, then use dirn=0 (the default).
Version 0.4 offered the equivalent of dirn=0 through two_tailed=True and dirn=1 through two_tailed=False but it did not offer one-tailed inference in the opposite direction. Note that dirn is relevant only to t-related tests; all other statistics including F and T² have only positive values so they do not accept dirn as a keyword argument.