3 Regression Methods for Completely Randomized Experiments

Linear Regression with No Covariates

Recall that

Yiobs=Yi(1)Wi+Yi(0)(1−Wi),Wi⊥(Yi(1),Yi(0))Y_{i}^{obs}=Y_{i}(1)W_i+Y_{i}(0)(1-W_{i}), \quad W_{i}\perp(Y_i(1),Y_i(0))

rearrange the terms:

Yiobs=[Yi(1)−Yi(0)]Wi+Yi(0)Y_{i}^{obs}=\left[ Y_{i}(1)-Y_{i}(0) \right] W_i + Y_{i}(0)

I want to turn this into a linear regression model Yiobs∼WiY_{i}^{obs}\sim W_{i}. The slope is

Cov(Yiobs,Wi)Var(Wi)=E[[Yi(1)−Yi(0)]Wi2]−E[[Yi(1)−Yi(0)]Wi]E[Wi]E[Wi2]−E[Wi]2=…=τsp\begin{align} \frac{\mathrm{Cov}(Y_i^{obs},W_{i})}{\mathrm{Var}(W_i)} & = \frac{\mathbb{E}\left[ [ Y_{i}(1)-Y_{i}(0) ]W_{i}^{2} \right]-\mathbb{E} [[ Y_{i}(1)-Y_{i}(0) ]W_{i}]\mathbb{E}[W_i]}{\mathbb{E}[W_i^{2}]-\mathbb{E}[W_i]^{2}} \\ & = \dots \\ & = \tau_{sp} \end{align}

The intercept is

E[Yiobs]−τspE[Wi]=⋯=μc\mathbb{E}[Y_{i}^{obs}]-\tau_{sp}\mathbb{E}[W_i]=\dots=\mu_{c}

Therefore the following linear model can be set:

Yiobs=α+τWi+εiY_{i}^{obs}=\alpha+\tau W_i+\varepsilon_i

where α=μc, τ=τsp\alpha=\mu _{c},\ \tau=\tau _{sp}.

We can show that

εi={Yi(0)−μcif Wi=0Yi(1)−μtif Wi=1\varepsilon_i=\begin{cases} Y_{i}(0)-\mu _{c} & \text{if}\ W_i=0 \\ Y_{i}(1)-\mu _{t} & \text{if}\ W_i=1 \end{cases}

The OLS estimators α^,τ^\hat{\alpha},\hat{\tau} are respectively Yˉcobs,Yˉtobs−Yˉcobs\bar{Y}_c^{obs}, \bar{Y}^{obs}_t-\bar{Y}^{obs}_c (I met this so many times).

Justification for Linear Regression

We'll see whether εi\varepsilon _{i} satisfies the assumptions made by linear regression.

  • Independence: Given all WiW_i's, each εi\varepsilon_i is a function of (Yi(1),Yi(0))(Y_{i}(1),Y_{i}(0)). As we know (Yi(1),Yi(0))(Y_{i}(1),Y_{i}(0))'s are i.i.d., so εi\varepsilon_i's are mutually independent. It holds under both randomization of the treatment assignment discussed here.
  • Zero conditional mean: E[εi∣Wi]=0\mathbb{E}[\varepsilon _{i}\mid W_{i}]=0. The key is Wi⊥(Yi(1),Yi(0))W_i\perp(Y_{i}(1),Y_{i}(0))
  • Equal variances: V[εi∣Wi]=σt2Wi+σc2(1−Wi)\mathbb{V}[\varepsilon _{i}\mid W_{i}]=\sigma^{2}_{t}W_i+\sigma^{2}_{c}(1-W_i). If σt2=σc2\sigma^{2}_{t}=\sigma^{2}_{c}, equal variance holds.
  • Exogenous: Cov(Wi,εi)=E[Wiεi]=0\mathrm{Cov}(W_{i},\varepsilon _{i})=\mathbb{E}[W_i\varepsilon_i]=0, which is a corollary of zero conditional mean.

Inference

Assume Equal Variances

Assume σt=σc=σ\sigma_{t}=\sigma_{c}=\sigma.

Let

X=(1Nc0Nc1Nt1Nt)β=(ατ)X=\begin{pmatrix} 1_{N_c} & 0_{N_c} \\ 1_{N_t} & 1_{N_t} \end{pmatrix}\quad \beta=\begin{pmatrix} \alpha \\ \tau \end{pmatrix}

Then

Yobs=Xβ+εY^{obs}=X\beta+\varepsilon

From Lec3-Statistical-Inference-and-Power we know

V[τ^]=σ2∑i=1N(Wi−Wˉ)2=σ2(1Nc+1Nt)\mathbb{V}[\hat{\tau}]=\frac{\sigma^{2}}{\sum_{i=1}^{N} (W_{i}-\bar{W})^{2}}=\sigma^{2}\left( \frac{1}{N_c}+\frac{1}{N_t} \right)

And σ^2=s2=SSEN−2=1N−2(sc2(Nc−1)+st2(Nt−1))\hat{\sigma}^{2}=s^{2}=\frac{SSE}{N-2}=\frac{1}{N-2}\left( s_c^{2}(N_c-1)+s_t^{2}(N_t-1) \right). So the variance estimator for V[τ^]\mathbb{V}[\hat{\tau}] is the same as V^const\hat{\mathbb{V}}^{\mathrm{const}} here.

Allow Non-Equal Variances

The the robust variance estimator in linear regression is the same as V^neyman=sc2Nc+st2Nt\hat{\mathbb{V}}^{\mathrm{neyman}}=\frac{s^{2}_{c}}{N_{c}}+\frac{s^{2}_{t}}{N_{t}}.

The model

Y=Xβ+εY=X\beta+\varepsilon

where each component of ε\varepsilon has its own variance σi2\sigma^{2}_{i}.

The estimator

β^=(XTX)−1XTY=(XTX)−1XT(Xβ+ε)=β+(XTX)−1XTε\hat{\beta}=(X^TX)^{-1}X^TY=(X^TX)^{-1}X^T(X\beta+\varepsilon)=\beta+(X^TX)^{-1}X^T\varepsilon

The covariance matrix of β^\hat{\beta}

V[β^]=(XTX)−1XTΣX(XTX)−1\mathbb{V}[\hat{\beta}]=(X^TX)^{-1}X^T\Sigma X(X^TX)^{-1}

where

Σ=diag(σi2)\Sigma=\mathrm{diag}(\sigma^{2}_{i})

(Assume no correlation)

Σ^=diag(ei2)\hat{\Sigma}=\mathrm{diag}(e_{i}^{2})

can be used to estimate Σ\Sigma. The estimate is HC0.

V^robust,HC0[τ^]=∑(Wi−Wˉ)2ei2[∑(Wi−Wˉ)2]2=…=(Nc2(Nt−1)N2st2+Nt2(Nc−1)N2sc2)N2Nc2Nt2=(Nt−1)st2Nt2+(Nc−1)sc2Nc2\begin{align} \hat{\mathbb{V}}^{\mathrm{robust},HC_{0}}[\hat{\tau}] & = \frac{\sum (W_i-\bar{W})^{2}e_{i}^{2}}{\left[ \sum(W_i-\bar{W})^{2} \right]^{2}} \\ & = \dots \\ & = \left( \frac{N_c^{2}(N_{t}-1)}{N^{2}}s_t^{2}+\frac{N_t^{2}(N_c-1)}{N^{2}}s_c^{2} \right) \frac{N^{2}}{N_c^{2}N_t^{2}} \\ & = \frac{(N_{t}-1)s_t^{2}}{N_t^{2}}+\frac{(N_{c}-1)s_c^{2}}{N_c^{2}} \end{align}

with HC2 adjustment,

V^robust,HC2[τ^dif]=V^neyman\hat{\mathbb{V}}^{\mathrm{robust},HC_{2}}[\hat{\tau}^{\mathrm{dif}}] = \hat{\mathbb{V}}^{\mathrm{neyman}}

Another Interpretation: Under Imputation (填补)

Recall the key challenge: missing data. So we cannot know each unit's treatment effect τi\tau_{i} in reality. We can just estimate it, say

τ^i={Yi(1)−Y^i(0)if Wi=1Y^i(1)−Yi(0)if Wi=0\hat{\tau}_i = \begin{cases} Y_{i}(1)-\hat{Y}_{i}(0) & \text{if}\ W_i=1 \\ \hat Y_{i}(1)-Y_{i}(0) & \text{if}\ W_i=0 \\ \end{cases}

where Y^i(0)=Yˉcobs,Y^i(1)=Yˉtobs\hat{Y}_{i}(0)=\bar Y^{obs}_c, \hat{Y}_i(1)=\bar{Y}^{obs}_{t}.

Then use τ^=1N∑i=1Nτ^i\hat{\tau}=\frac{1}{N}\sum_{i=1}^{N}\hat{\tau}_{i} to estimate τsp\tau_{sp}, which equals to Yˉtobs−Yˉcobs\bar{Y}^{obs}_{t}-\bar{Y}^{obs}_{c}

Yet Another Interpretation: Under Limitation

The regression model is

Yiobs=α+τWi+εiY_{i}^{obs}=\alpha+\tau W_{i}+\varepsilon_{i}

LS estimate

(τ^,α^)=argmin⁡α,τ∑i=1N(Yiobs−α−τWi)2=argmin⁡α,τ1N∑i=1N(Yiobs−α−τWi)2(\hat{\tau},\hat{\alpha})=\operatorname*{argmin}_{\alpha,\tau}\sum_{i=1}^{N} (Y^{obs}_{i}-\alpha-\tau W_{i})^{2}=\operatorname*{argmin}_{\alpha,\tau}{\color{blue}\frac{1}{N}}\sum_{i=1}^{N} (Y^{obs}_{i}-\alpha-\tau W_{i})^{2}

When sample size goes to infinity

(α∗,τ∗)=argmin⁡α,τE[(Yiobs−α−τWi)2](\alpha^*,\tau^{*})=\operatorname*{argmin}_{\alpha,\tau}\mathbb{E}\left[ (Y^{obs}_{i}-\alpha-\tau W_{i})^{2} \right]

We know from the OLS theory E[Yiobs∣Wi]=α∗+τ∗Wi\mathbb{E}[Y_{i}^{obs}\mid W_{i}]=\alpha^{*}+\tau^{*}W_i, so

τ∗=E[Yiobs∣Wi=1]−E[Yiobs∣Wi=0]\tau^{*}=\mathbb{E}[Y_{i}^{obs}\mid W_{i}=1]-\mathbb{E}[Y_{i}^{obs}\mid W_{i}=0]

With CRE,

τ∗=E[Yiobs∣Wi=1]−E[Yiobs∣Wi=0]=E[Yi(1)∣Wi=1]−E[Yi(0)∣Wi=0]=E[Yi(1)]−E[Yi(0)]=τsp\begin{align} \tau^{*} & = \mathbb{E}[Y_{i}^{obs}\mid W_{i}=1]-\mathbb{E}[Y_{i}^{obs}\mid W_{i}=0] \\ & = \mathbb{E}[Y_{i}(1)\mid W_{i}=1]-\mathbb{E}[Y_{i}(0)\mid W_{i}=0] \\ & = \mathbb{E}[Y_{i}(1)]-\mathbb{E}[Y_{i}(0)] \\ & = \tau_{sp} \end{align}

Here is a more elementary proof.

Note that τ^→pτ∗\hat{\tau}\overset{p}{\to}\tau^*. The unbiasedness is not ensured.

Linear Regression with Covariates

Add Covariates

Regression model:

Yiobs=α+τWi+Xiβ+εiY_{i}^{obs}=\alpha+\tau W_{i} + X_{i}\beta+\varepsilon_{i}

where XiX_{i} could be a vector, denoting the covariates.

Similarly, when sample size goes to infinity

(τ^ols,α^ols,β^ols)→(τ∗,α∗,β∗)(\hat{\tau}^{ols},\hat{\alpha}^{ol s},\hat{\beta}^{ol s})\to (\tau^{*},\alpha^{*},\beta^{*})

where (τ∗,α∗,β∗)(\tau^{*},\alpha^{*},\beta^{*}) satisfy

(τ∗,α∗,β∗)=argmin⁡α,β,τE[(Yiobs−α−τWi−Xiβ)2](\tau^{*},\alpha^{*},\beta^{*})=\operatorname*{argmin}_{\alpha,\beta,\tau}\mathbb{E}[(Y_{i}^{obs}-\alpha-\tau W_{i}-X_{i}\beta)^{2}]

Okay, lets see E[… ]\mathbb{E}[\dots] then.

We can deal with (α~,τ)(\tilde{\alpha},\tau) and β\beta separately, the latter in fact is not our concern. And with the conclusion before, we know that τ∗=τsp\tau^{*}=\tau_{sp}.

Theorem: Suppose we conduct a completely randomized experiment in a sample drawn at random from an infinite population. Then

(1) τ∗=τsp(2) N(τ^ols−τsp)→dN(0,E[(Wi−p)2(Yiols−α∗−τspWi−Xiβ∗)2]p2(1−p)2)\begin{aligned} (1)\ &\tau^{*}=\tau_{sp}\\ (2)\ &\sqrt{N}(\hat{\tau}^{ol s}-\tau_{sp})\overset{d}{\to}N\left( 0, \frac{\mathbb{E}\left[ (W_{i}-p)^{2}(Y_{i}^{ol s}-\alpha^{*}-\tau_{sp}W_{i}-X_{i}\beta^{*})^{2} \right] }{p^{2}(1-p)^{2}} \right) \end{aligned}

where p=E[Wi]p=\mathbb{E}[W_{i}].

  • Connect the variance's shape with the sandwich variance estimator introduced above.
  • The theorem is still correct even if the regression model is wrong.

Model Comparisons

Adding covariates can reduce the variance of τ^ols\hat{\tau}^{ol s}.

Add Interaction Term

Why adding interaction term? Because Y(1)∼XY(1)\sim X and Y(0)∼XY(0)\sim X can have different coefficients for XX.

This perspective has not been introduced until 2008. But Fisher already added covariates into the regression model. Why he didn't notice this? The potential outcome framework was not invented by then. Without a good expression, people cannot see through things well.

GPT's summary:

正确识别加入协变量的回归式

回归 非参 线性模型错的,仍然可用

加入协变量,减小方差。-> 协变量越多越好?并非,虽然理论上放进来不会更差,但有限样本,分得越细,样本越少,估计越不准。

有时引入协变量方差会变大。 Y(1),Y(0)Y(1),Y(0) 关于 XX 的斜率不一定相同。2008 年才提出来。(Fretman? ) 加入 XWXW 交叉项。

Fisher 早就提出加入协变量回归,但一直没发现问题。语言不好,框架不好(彼时没有潜在结果的语言)

机器学习的估计很难给出区间估计,不知其渐进分布。


3 Regression Methods for Completely Randomized Experiments
https://wtx17.github.io/2026/09/30/3-Regression-Methods-for-CRE/
作者
wtx
发布于
2026年9月30日
更新于
2026年11月6日
许可协议