# Why is the test statistic in a two sample t-test t distributed?

I don't understand why the test statistic of a two sided two sample t-test actually t distributed is. The test statistic is definded as:

$T=\sqrt{\frac{n_1n_2}{n_1+n_2}}(\frac{\bar{Y}-\bar{X}}{\sqrt{\frac{1}{n_1+n_2-2}(\sum_{i=1}^{n_1}(X_i-\bar{X})^2+\sum_{j=1}^{n_2}(Y_j-\bar{Y})^2})})$ with $X_i$ and $Y_j$ normally distributed with mean m and variance v (under $H_0$) for all $i=1...n_1$ and $j=1...n_2$ .

To show that T is t distributed it has to be shown that $A:= \bar{Y}-\bar{X}$ and $B:=X_i-\bar{X}$ and $C:=Y_j-\bar{Y}$ are independent and standard normally distributed. Is that right?

I was able to calculate that the mean of $A$ is indeed zero and but the variance of $\sqrt{\frac{n_1n_2}{n_1+n_2}}\cdot A$ is equal to v (not 1).

I don't understand how to show the independence. Can someone help me?

• Showing A,B and C to be independent and normal would establish that the numerator is normal (i.e. $\bar{Y}-\bar{X}$) but that alone won't establish that you have a $t$ distribution for the statistic. – Glen_b Sep 10 '17 at 7:00
• In the lecture we were given this defiition for a t-distribution: If $Y, X_1, ... , X_n$ are independent and standard normally distributed then $\frac{Y}{\sqrt{\frac{1}{n}\sum\limits_{i=1}^n X_i^2}}$ is t distributed with n degrees of freedom – Lucy Sep 10 '17 at 8:32
• YepThat's right. So if you have numerator and denominator independent you can get somewhere. $\bar{Y}$ and $s^2_X$ will be independent for the obvious reason (and vice versa), so you need independence of $\bar{X}$ and $s^2_X$ (and similarly for $Y$). You should have something about this; if you haven't had this proved or at least stated for you, you can get it as a consequence of Basu's theorem for example. en.wikipedia.org/wiki/Basu%27s_theorem – Glen_b Sep 10 '17 at 8:59
• So the numerator would be $\frac{1}{n_2}\sum\limits_{j=1}^{n_2} Y_j-\frac{1}{n_1}\sum\limits_{i=1}^{n_1} X_i$ and the denominator $\sqrt{\frac{1}{n_1+n_2-2}(\sum\limits_{i=1}^{n_1} X_i^2-\frac{1}{n_1}(\sum\limits_{i=1}^{n_1} X_i)^2+\sum\limits_{j=1}^{n_2} Y_j^2-\frac{1}{n_2}(\sum\limits_{j=1}^{n_2} Y_j)^2)}$ How do I show that they are independent? – Lucy Sep 10 '17 at 9:11
• Cincerning your last comment: I thought I have to show that $\bar{X}$ is indpendent of $X_i-\bar{X}$ and the same for $Y$. Or does this follow from your comment? – Lucy Sep 10 '17 at 9:23

$$t=\frac{\bar{x}-\mu_{H_0}}{SE_{\bar{x}}}$$
where $\bar{x}$ is the observed mean difference, $\mu_{H_0}$ is the null hypothesised value of the population mean difference, and $SE_{\bar{x}}$ is the standard error of $\bar{x}$.
• If I do this with $\bar{x}=\bar{Y}-\bar{X}$ , $\mu_{H_0}=E_{H_0}(\bar{Y}-\bar{X})=0$ and $SE_{\bar{x}}=\frac{1}{n_1+n_2} V(\bar{Y}-\bar{X})=\frac{v(n_1-n_2)}{(n_1+n_2)n_1 n_2}$ (V is the variance) This is standard normally distributed right? How do I go from there to get the t distribution? – Lucy Sep 10 '17 at 8:56