A graphical explanation of fixed effects

Many applications in econometrics involve controlling for so called fixed effects (FE). That is, including a dummy variable for each e.g state, year, firm e.t.c. The reason for including FE’s are many and varies depending on the context but what it does is broadly controlling for things that are omitted and in the case of “entity fixed effects” (which I will focus on here) these are omitted variabels that can vary over time but not within entity. For example, say that you are trying to explain voting behavior across states with income. Regressing a dummy of republican/democratic governance on income (with the dummy being equal to unity if republican governance) one omitted variable might be culture. If culture varies by state and roughly constant over time you can control for that by including state fixed effects. That is the simple explanation with a highly stylized example. Rather, in most cases the reason for including FE’s can be pretty vague and difficult to grasp what they are actually doing in practice. Hence, I have decided to try to make an intuitive graphical explanation of FE’s.

Consider the case that you would like to know the (casual) relationship between wage and tenure. You have collected data from three firms and drawn a sample of  30 individuals in each. I have generated this example data such that mean wage is firm specific so, \begin{aligned} Wage_{1i} = 10000 + \varepsilon_{i} \\ Wage_{2i} = 15000 + \varepsilon_{i} \\ Wage_{3i} = 20000 + \varepsilon_{i} \end{aligned}

and tenure, \begin{aligned} Tenure_{1i} = 10 + u_{i} \\ Tenure_{2i} = 15 + u_{i} \\ Tenure_{3i} = 20+ u_{i} \end{aligned}

with $\varepsilon \sim N(0,2000)$ and $u \sim N(0,3)$. The graph below depicts the relationship between wage and tenure with a highly significant OLS estimate of 640.47 running the regression $Wage_{ki} = \alpha + \beta Tenure_{ik} + \nu_{ik}$ where $i$ is individual and $k$ firm. Hence there is a clear correlation(!) between wage and tenure. But there is something fishy with this estimate. It is not a causal estimate of the effect of tenure on wage. Rather, if we look at the data above, it appears as if it is all driven by which firm you work at! This is an omitted variable that can be dealt with using firm FE’s.  In fact, I constructed the data so that there should be no causal effect of tenure on wage. Let’s look at the regressions within firms depicted in the figure below, As you can see, there is no clear positive pattern and each separate firm regression has $\beta_{k}$ not significantly different from zero. But we don’t want to run three separate regressions. Rather we want to control for the effects on wage caused by the firm itself. What we do is we run the same regression as above but include firm FE’s (i.e. a dummy variable for each firm), $Wage_{ik} = \alpha + \delta Tenure_{ik} + \sum_{k=1}^{3} \gamma_{k} 1[Firm= k] + \eta_{ik}$

What this effectively does is estimating the relationship between wage and tenure within(!) each firm and weights the coefficients into  one $\delta$ which controls for the effect on wage coming from the firm specific component. $\delta$ delivers the weighted average effect of tenure on wage holding constant which firm an individual is working in. The graph below depicts the residualized wage and the linear fit has the slope of $\delta=0.965$. Note how residualizing wage from firm FE’s demeans everything and “levels out” the playing field. One interesting feature which I cannot explain is why the average of the estimates from the firm specific regressions $(\beta_{1} + \beta_{2} + \beta_{3})/3 \neq \delta$. My prior was that the single FE estimate would be the plain average of these three coefficients as there are equal number of observations in each firm but it turns out it isn’t. If somebody knows why this is drop a comment or email me. Or I might make a new post out of it once I figure it out.

Update: The reason $(\beta_{1} + \beta_{2} + \beta_{3})/3 \neq \delta$ is due to the fact that the FE-estimator is variance weighted. This should, nevertheless, imply that the FE-estimator converges to the average of the three separate estimates as $n \rightarrow \infty$.