# 2 period difference-in-differences fixed effects versus OLS

I have a question on the difference-in-differences estimator. Suppose my data consists of two periods and the treatment is administered to some of the individuals in period $t = 2$. I estimate this model:

$y_{it} = \beta_0 + \beta_1 treatment_i + \beta_2 year_t + \beta_3 treatment_i \times year_t + \beta_4 x_{it} + u_{it}$

for individuals $i = 1, \ldots, N$ and $t = 1, 2$. $treatment_i$ is the treatment dummy (1 for treated individuals, 0 otherwise), $year_t$ is a period dummy (1 for second period, 0 otherwise). I am interested in estimating $\beta_3$, the difference-in-differences coefficient. $x_{it}$ is a control variable and $u_{it}$ is the error term. Panel is balanced, so no missing observations.

Here's my question. If I run this regression without any control variables (so dropping $x_{it}$) then OLS and fixed effects give exactly the same estimate for $\beta_3$. However, in a model that includes one (or more than one) control variable(s) (so, including $x_{it}$ now), this is no longer the case. I.e., in that case, the fixed effects and OLS estimator of $\beta_3$ are no longer exactly the same. I've checked this in two datasets as well as using simulated data. The estimates are usually very similar, but nonetheless I'm interested in figuring out why fixed effects and OLS do not give exactly the same estimate for $\beta_3$ in a two-period DiD model with control variables (especially since I'm worried that I may be missing something really obvious). Thanks.

@Charlie is right. You only have two time periods, so there will inevitably be variation in the $i$-specific sample variances of $x_{it}$. In addition, even if you have programmed the simulation for there to be homogenous effects, due to small number of periods there will inevitably be some sample correlation between $x_{it}$ and, e.g., your error term, and so there will inevitably be some "effect heterogeneity" in the $i$-specific partial relationships between $x_{it}$ and $y_{it}$. The interaction of conditional variance and effect heterogeneity tilts your FE estimates of coefficients on $x_{it}$. The coefficient on $x_{it}$ is a precision-weighted average of the $i$-specific coefficients on $x_{it}$. A different tilting occurs when you fit OLS to the model that you have specified above: now, the coefficient on $x_{it}$ is a precision weighted average of the coefficients on $x_{it}$ for the those with $treatment_i=1$ and those with $treatment_i=0$. These differences propagate to your estimates of $\beta_3$. Think Frisch-Waugh-Lovell. To demonstrate the validity of Charlie's claim, simply generate $x_{it}$'s where the variance is exactly constant for each $i$, but you still have different patterns. E.g, randomly assign $i$'s to have either $(x_{i1}, x_{i2})=(0,1)$ or $(1,0)$. If you do this, you will see that the differences between the FE and OLS estimates disappears.
• @Charlie and Cyrus: thanks to both for your answer. Thanks also for your suggestion Cyrus - setting the variance of $x_{it}$ to be the same for each $i$ does the trick and yields OLS and FE estimates that are exactly the same. – Nicolas May 28 '12 at 14:46
In your model without $x$, it is fully flexible: all combinations of year and treatment are given different expected values. You are making no linearity assumptions here. Once you add in $x$, you are assuming that the response of $y$ to $x$ is linear and that this response does not depend upon the values of the fixed effects; that is, there is no heterogeneity in the impact of $x$. If there is heterogeneity, you can get different results using different estimation procedures.