# t test for slope with binary variable

Cosider two random samples: one from the variable $Y_1$, with $n_1$ observations and the other one from the variable $Y_2$ with $n_2$ observations. Let $\mu_1$ and $\mu_2$ be the sample means of these variables, with estimates $\bar{Y_1}$ and $\bar{Y_2}$. If we suppose normality, the hypothesis $H_0: \mu_1=\mu_2$ can be tested, by the t test

$$t=\frac{\bar{Y_1}-\bar{Y_2}}{\sqrt{\left( \frac{1}{n_1}+\frac{1}{n_2}\right) s^2}}$$ where $$s^2 = \frac{\sum_{i=1}^{n_1} (Y_{1i}-\bar{Y_1})^2+\sum_{i=1}^{n_2}(Y_{2i}-\bar{Y_2})^2}{n_1+n_2-2}$$

I want to show that the t test for comparing population means with the same variance is the same as when we are testing $$H_0: \beta=0$$ in the following regression model:

$$Y_{ki} = \alpha +\beta Z_{ki} + u_{ki}$$

where

$Z_{ki}$ is a binary variable equals -1 when the observations are from a sample, and +1 when the observations are from the other sample; $k=1,2$ indicates if the observation is from $Y_1$ or $Y_2$; and $i$ varies from 1 to $n_1$ if $k=1$ and from 1 to $n_2$ if $k=2$.

I tried to figure this question out by comparing the test statistic $$t=\frac{\hat{\beta}-\beta_0}{\sqrt{MS_E/S_{xx}}},$$

(where $MS_{E}$ is the mean square error) with the first one showed at the beggining of this post, but I could not figure out how to continue from there.

• I think you need to check on probit regression: en.wikipedia.org/wiki/Probit_model. – lowtech Oct 23 '14 at 17:09
• @lowtech Could you be a little more explicit about what connection probit regression might have with this question? Caroline, have you worked out what the three distinct entries in the (symmetric) matrix $X^\prime X$ must be? And what do you mean by "$c_{ii}$"? – whuber Oct 23 '14 at 17:20
• @whuber regression model with binary dependent variables - is it a hint to use probit instead of linear regression? am i missing something? – lowtech Oct 23 '14 at 17:47
• @lowtech The binary variable here is independent: it merely distinguishes the two sets of samples. – whuber Oct 23 '14 at 17:49
• @whuber, I changed this part of the question to make it easier to understand. – Caroline Oct 24 '14 at 0:10