# Simple Regression With Dummy Variable

Consider a simple linear model:

$Y = \beta_1 + \beta_2 MALE + u$

where $MALE$ is a dummy variable. $MALE = 0$ if female, $MALE = 1$ if male.

A model is fitted:

$\hat{Y} = \hat{\beta_1} + \hat{\beta_2} MALE$

$\bar{Y_F}$ and $\bar{Y_M}$ are the sample means of $Y$ for females and males respectively.

Prove that:

$\hat{\beta_1} = \bar{Y_F}$, $\hat{\beta_2} = \bar{Y_M} - \bar{Y_F}$

If the points are plotted in a scatter block, there will be two vertical clusters of points at $MALE = 0$ and $MALE = 1$, as shown:

It seems intuitively obvious that the total residual sum of squares ($RSS$) is minimized by minimizing the $RSS$ separately for the female and male points. This is achieved by fitting a point at the mean of these points, $\bar{Y_F}$ and $\bar{Y_M}$. Fitting a line between these point yields the correct values for $\hat{\beta_1}$ and $\hat{\beta_2}$.

I wish to prove this algebraically.

• This is not a place to get homeworks done. If you provide your solution (or at least a try) and explain your doubts, you can get help Commented Jun 6, 2018 at 9:42
• @Alessandro Thank you for your comment. I have gone away and attempted the question again. My answer is as below. Commented Jun 6, 2018 at 12:02

Find $\hat{\beta_2}$:

$$\hat{\beta_2}=\frac{\Sigma(Y_i-\bar{Y})(MALE - \overline{MALE})}{\Sigma(MALE - \overline{MALE})^2}$$

Assuming m males in a sample of n people, $$\overline{MALE}=\frac{m}{n}$$

We can say:

$$MALE - \overline{MALE}=\begin{cases}-\frac{m}{n} & \text{if }MALE=0\\\\\frac{n-m}{n} & \text{if }MALE=1\end{cases}$$

With some algebra, the numerator of $\hat{\beta_2}$ becomes:

$$\Sigma(Y_i-\bar{Y})(MALE - \overline{MALE})=\frac{m(n - m)}{n}(\bar{Y_M} - \bar{Y_F})$$

The numerator of $\hat{\beta_2}$ becomes:

$$\Sigma(MALE - \overline{MALE})^2=\frac{m(n - m)^2 + m^2(n - m)}{n^2}=\frac{m(n - m)}{n}$$

Dividing the two gives the correct answer:

$$\hat{\beta_2}=\bar{Y_M} - \bar{Y_F}$$

Find $\hat{\beta_1}$:

$$\hat{\beta_1}=\bar{Y}-\hat{\beta_2}\overline{MALE}=\frac{m\bar{Y_M}+(n - m)\bar{Y_F}}{n} - (\bar{Y_M} - \bar{Y_F})\frac{m}{n}=\bar{Y_F}$$