# Two sample t-test with equal variance - two equations

The equation for this test is the following (that's how it is stated in most texts). I got a proof that it indeed has a t-distribution:

$$T=\frac{(\bar{X}-\bar{Y})-(\mu_x-\mu_y)}{S_p\sqrt{\frac{1}{n}+\frac{1}{n}}}$$

However, I've also seen it in the following form:

$$T=\frac{(\bar{X}-\bar{Y})}{S_p\sqrt{\frac{1}{n}+\frac{1}{n}}}$$

How can we prove that also the second test has a t-distribution? Why some books describe the test with the second equation?

Under the usual null hypothesis, $$H_0: \mu_x = \mu_y$$, so the equations are identical.

• So it works like: we take the first formula, assume the means are identical in both populations and see what's the probability of them being equal based on the distribution of T (second equation)? If the probablity is very low, we deduce that it's not very likely the means are equal. Commented Aug 13, 2015 at 16:39
• yes. that is basically it. Commented Aug 13, 2015 at 17:06
• @user4205580 & mandata Without context it's hard to say, but my guess is the first formula is meant to test the null hypothesis $E(X) - E(Y) = \mu_X - \mu_Y$. Still, in both cases the statistic is t-distributed under the null hypothesis. Commented Aug 13, 2015 at 18:18
• This is not correct. The first equation works whether $\mu_z=\mu_y$ under the null hypothesis or not.
– Dave
Commented Jun 6, 2023 at 0:48

To supplement the answer by @mandata, the first "version" could be useful if you want to test for an "effect size" greater than some pre-determined value, say $$\Delta$$. In this case, the null hypothesis

$$H_0: \mu_x - \mu_y = \Delta$$ could be tested against the alternative hypothesis $$H_1: \mu_x - \mu_y > \Delta.$$

In this setting, the distinction between the two test statistics becomes important.

• It doesn’t even have to be for one-dozen testing. The first equation works for a two sided test.
– Dave
Commented Jun 6, 2023 at 0:49
• @Dave I'm unsure what you're trying to say. My answer wasn't meant to imply a difference between one-sided and two-sided testing. My point is simply that the first equation is more general than the second. To do a test like this (or a two-sided version, if you prefer), the second test statistic in the OP is not general enough. Commented Jun 6, 2023 at 17:14