Why is it in a $t$-test for difference in means, if the alternative hypothesis is $\mu_X-\mu_Y>0$, then we seek a right-tailed test and vice-versa?

In a $t$-test for difference in means, the null is usually specified as $\mu_X-\mu_Y = 0$ and the alternative hypothesis is EITHER $\mu_X-\mu_Y>0$, or $\mu_X-\mu_Y<0$. In any testing, we normally find the observed $t$-statistic, which we call $t^*$, and then compared it using the p-value, defined as:

$$P(t^*>t|H_0)$$

where it is defined to be the probability of observed a $t$-statistic as extreme as the one we observed from the data, GIVEN we are under the null distribution. This p-value corresponds normally to the right-tailed test, where the alternative is $\mu_X-\mu_Y>0$. For the case where $\mu_X-\mu_Y<0$, our p-value then becomes $P(t^*<t|H_0)$.

My question then is: why does $\mu_X-\mu_Y>0$ translate to finding the probability of the $t$-statistic being greater than some observed $t$ under the null distribution and vice versa? I understand that the statistic itself, $\mu_X-\mu_Y>0$ has direction, but why does it translate to $t^*$ having that direction too? Is it by the fact dividing by the standard deviation is dividing by something positive and hence directions are preserved?

Meaning, the statistic $\mu_X-\mu_Y$ is invariant in terms of sign due to the standard deviation being a positive value?

The P-value is the probability of a value of the test statistic as or more extreme that what was observed--in the direction, or direction(s) of the alternative. Right tail for alternative $>,$ left tail for alternative $<,$ both tails for alternative $\ne.$

Here is output for left- and two-tailed tests, done in Minitab. Same data, same null hypothesis, different P-values. Left-sided is significant at 5% level, two-sided is not.

One-Sample T
Test of μ = 100 vs < 100

N   Mean  StDev  SE Mean  95% Upper Bound      T      P
9  91.23  13.20     4.40            99.41  -1.99  0.041

One-Sample T
Test of μ = 100 vs ≠ 100

N   Mean  StDev  SE Mean       95% CI          T      P
9  91.23  13.20     4.40  (81.08, 101.38)  -1.99  0.081


In the following plot the P-value for the two-sided test is the area outside the two vertical lines (left line for observed $T,$ right dotted line just as far from 0 in the opposite direction).

• Could I ask why the p-value is in the direction of the alternative? It seems the p-value deals with the $t$ statistic while the alternative deals with the data. Why does the data being some direction translate into the $t$ statistic being in that same direction? – user321627 Dec 14 '16 at 10:39
• Consider $H_a: \mu < 100$ in my Answer. $\bar X$ is the estimate of $\mu.$ We will Rej $H_0: \mu = 100$ in favor of $H_a$ if $\bar X$ is much smaller than 100. That is, if $\bar X - 100$ is much smaller than 0. To decide what 'much' means we find $T=(\bar X - 100)/[S/\sqrt{n}]$ and Rej if $T < t^*,$ where $t^*$ is critical val from table. So "$\bar X - 100$ much smaller than 0" becomes" $T < t^*.$" Thus t statistic reflects data and hypothetical value of $\mu.$ – BruceET Dec 14 '16 at 16:40