# Variance of $\beta_{1}$ in simple linear regression with dummy variable

I want to continue on the work here, and come to a condensed form of the estimated variance of the average treatment effect.

Consider

\begin{align*} Y_{i} = \beta_{0} + \beta_{1}D_{i} + \varepsilon_{i} \end{align*}

where $$D_{i}=1$$ if the $$i$$th unit is in the treatment group and $$0$$ otherwise (the controlled group).

What is an estimation for $$\text{Var}(\widehat{\beta_{1}})$$, with respect to the sample variances of the treatment and controlled groups?

May someone please look over my work and logic?

I begin by recalling that

\begin{align*} \text{Var}(\widehat{\beta_{1}}) = \frac{\sigma_{\varepsilon}^{2}}{\sum_{i=1}^{N}(D_{i} - \overline{D})^{2}} \end{align*}

Let $$p$$ be the proportion of $$N$$ in the treatment group. Therefore $$1-p$$ is the proportion in the controlled group. It can be shown that

\begin{align*} \sum_{i=1}^{N}(D_{i} - \overline{D})^{2} = Np(1-p) \end{align*}

We are left to find the numerator, which can be estimated as

\begin{align*} \sigma_{\varepsilon}^{2} = \frac{\sum_{i=1}^{N}(Y_{i} - (\widehat{\beta_{0}}+\widehat{\beta_{1}}D_{i}))^{2}}{N-2} \end{align*}

After doing the algebra - I reach that

\begin{align*} \widehat{\text{Var}(\widehat{\beta_{1}})} = \frac{\widehat{\text{Var}(\overline{Y_{T}})}}{(N-2)(1-p)} + \frac{\widehat{\text{Var}(\overline{Y_{C}})}}{(N-2)(p)} \end{align*}

where $$\overline{Y_{T}}$$ is the sample average of the treatment group; notation generalised to $$\overline{Y_{C}}$$.

May someone please see if they reach the same conclusion? I used the following results

\begin{align} \text{Var}(X) &= \mathbb{E}(X^{2}) - \mathbb{E}(X)^{2} \\ \\ \overline{Y} &= p\overline{Y_{T}} + (1-p)\overline{Y_{C}} \\ \\ \overline{Y_{T}} &= \frac{1}{Np}\sum_{i=1}^{N}Y_{i|D_{i}=1} \\ \\ \overline{Y_{T}} &= \frac{1}{N(1-p)}\sum_{i=1}^{N}Y_{i|D_{i}=0} \end{align}

Thank you very much for your help

Gus