# t-statistics in two sample t-test and OLS regression

I was given such a scenario below:

You decide to test the null hypothesis that there is no difference between income paid to men and income paid to by women. You bucket your data according to gender - and use a pooled variance Differences-in-Means t-test:

And then,

In addition to the pooled variance Differences in- Means t-test (results provided above) - you decide to run the following OLS regression:

My question is, why is the t-statistics in two sample t-test the same as the t-statistics for Male in the OLS regression (i.e. the correct answer C )? Is D possible though?

The secret to this is that the estimator of the slope, $$\hat{ \beta_1}$$ is the average male income minus average female income. I.e : $$\hat{\beta_1} = \bar{x} - \bar{y}$$ where $$x$$ and $$y$$ represent the vectors of income for males and females used in the first half of the problem. So in reality testing the hypothesis $$\hat{\beta_1} = 0$$ is the same as testing if the means between genders are different

This may not be completely obvious at first, but it is possible to work it out, even in this case. The algebra may not be the prettiest to dig into, and I apologise if it seems like a lot to take in, but let's see if we can show this

First off, I'm going to be using the formula $$\hat{\beta_1} = \frac{n\left( \sum xy \right) - \sum x \sum y}{n\left( \sum x^2 \right) - \left( \sum x \right) ^2 }$$

Next, although we don't know the points for the data, let's suppose we let the x-values represent gender ($$0$$ if female and $$1$$ if male) and let the y-values be income.

Finally, for some notation, I will denote $$\$$ to be the sum of all income, $$\_m$$ to be the sum of all income for males, $$\_f$$ to be the sum of all income for females, $$m$$ be the total number of males, and $$f$$ the total number of females.

With all of that out of the way, let the algebra do the magic:

$$\hat{\beta_1} = \frac{n\left( \sum xy \right) - \sum x \sum y}{n\left( \sum x^2 \right) - \left( \sum x \right) ^2 }$$

$$\hat{\beta_1} = \frac{(m+f)\left( \_m\right) - m \}{(m+f)\left( m \right) - \left( m \right) ^2 }$$

$$\hat{\beta_1} = \frac{(m+f)\left( \_m\right) - m \}{m^2 + mf - m^2 }$$

$$\hat{\beta_1} = \frac{m\_m + f\_m - m \}{mf }$$

$$\hat{\beta_1} = \frac{m\left(\_m - \ \right) + f\_m }{mf }$$

$$\hat{\beta_1} = \frac{m\left(-\_f \right) + f\_m }{mf }$$

$$\hat{\beta_1} = \frac{-\_f }{f } + \frac{\_m}{m}$$

$$\hat{\beta_1} = \frac{\_m}{m} - \frac{\_f }{f }$$

And behold, we arrive at the estimate to be equal to the average income of males minus the average income of females.