# interpretation: linear regressions with both unit dummies and time dummies

Suppose I have a panel data with N units and T time periods.

• For model 1 with only unit dummies: $$y_{it} = \text{intercept} + \beta_1 x_{it} + \sum_{j = 2}^{N}\delta_j I\left(i = j\right) + \text{error},$$ least squares estimation of $\beta_1$ only uses the within-unit across-time variation in $x$.
• For model 2 with only time dummies: $$y_{it} = \text{intercept} + \beta_2 x_{it} + \sum_{k = 2}^{T}\gamma_k I\left(t = k\right) + \text{error},$$ least squares estimation of $\beta_2$ only uses the within-time across-unit variation in $x$.
• For model 3 with both unit and time dummies: $$y_{it} = \text{intercept} + \beta_3 x_{it} + \sum_{j = 2}^{N}\delta_j I\left(i = j\right) + \sum_{k = 2}^{T}\gamma_k I\left(t = k\right) + \text{error},$$ least squares estimation of $\beta_3$ apparently does not use the within-unit within-time variation in $x$, because no such variation exists in the dataset.

My question is: what exactly is the variation used in model 3?

I understand that for model 3 we are essentially de-meaning $x$ and $y$ in forms like $$\tilde{x}_{it} = \left(x_{it} - \bar{x}_i \right) - \left(\bar{x}_t - \bar x \right),$$ where $\bar {x} _i$, $\bar {x} _t$, and $\bar {x}$ are within-unit mean, within-time mean, and total mean of $x$.

Economists using model 3 often loosely say they "have controlled for unit fixed effects and time fixed effects", but "controlling for x" usually have the ceteris paribus interpretation, meaning we are comparing within groups with same values of x. See this answer for a nice presentation. I'm looking for intuitive and verbose interpretations that are more precise than "controlling for unit fixed effects and time fixed effects".

## 2 Answers

what exactly is the variation used in model 3 with both unit and time dummies?

The variation that is being used to identify $\beta_3$ is basically the individual level deviations away from both the individual mean and average across individuals for the year. So to the degree that your variable of interest is varying over time but does not vary in a differential manner across individuals, you will fail to detect its effect.

Economists using model 3 often loosely say they "have controlled for unit fixed effects and time fixed effects", but "controlling for x" usually have the ceteris paribus interpretation, meaning we are comparing within groups with same values of x. See this answer for a nice presentation. I'm looking for intuitive and verbose interpretations that are more precise than "controlling for unit fixed effects and time fixed effects".

To be clear, when we say a unit fixed effect in econometrics, we are referencing any time invariant observed or unobserved determinant of the dependent variable. It's easy to show that all of these are "wiped out" by the individual level demeaning. The individual level demeaning also controls for the average differences in observed and unobserved independent variables across individuals. Individual fixed effects in the model mean that any source of bias must be time varying. Thus, if someone argues that your variable is endogenous on account of some variable that is constant in your sample, you have already controlled for that by only using variation over time to identify your point estimate.

So with the inclusion of these individual fixed effects you can focus on determining time varying covariates that determine your independent variable. Time fixed effects will strip away any changes in variables that are the same for all individuals in a given period of time. For instance, if "individuals" are grouped together in the same state or municipality, and there are some changes in state or municipal policies for all individuals in that year,then the time fixed effects could strip away these effects without a need for measuring them. This only leaves concern over variables that have different time paths within different individuals.

So with both time and panel fixed effects, to identify the effect of your variable of interest, exogeneity concerns aside, that variable of interest must

1. be time varying

and

1. have variation in within-individual time paths across individuals (i.e. individual heterogeneity, must be varying at $it$ not just homogeneous across $i$ within $t$.)

So we are indeed "controlling for" those time invariant unobserved confounding factors, as well as average differences in observed factors across individuals with panel fixed effects. We are indeed "controlling for" covariates that have common variation across individuals within a given year with time fixed effects.

Let $y_{it}=\beta_i+\lambda_t+X_{it}\beta+\epsilon_{it}$ be the specification with $i=1\dots N$ and $t=1\dots T$.

Initially you do the panel demeaning, which creates the transformed variable

$\overset{..}{y}=(y_{it}-\overline{y_i})=\underbrace{(\lambda_t-\frac{1}{T}\sum_{j=1}^{T}\lambda_j)}_\text{panel demeaned time dummies}+\text{other demeaned terms unrelated to year FE}$.

This removes the $\beta_i$, along with any other time invariant confounding factors.

Then you demean with year FE, doing the transformation $\overset{...}{y}=\overset{..}{y_i}-\overline{y_t}$ where $\overline{y_t}=\frac{1}{N}\sum_{j=1}^{N}y_{jt}$.

$=\underbrace{(\lambda_t-\frac{1}{T}\sum_{j=1}^{T}\lambda_j)-\frac{1}{N}\sum_{i=1}^{N}(\lambda_t-\frac{1}{T}\sum_{j=1}^{T}\lambda_j)}_\text{want to show this = 0}+\text{other demeaned terms unrelated to year FE}$

. .

since $\lambda_t$ is common to all $i$ in a given year, $\sum_{i=1}^{N} \lambda_t=N\lambda_t$ and similarly for $\sum_{i=1}^{N}\frac{1}{T}\sum_{j=1}^{T}\lambda_j=N \frac{1}{T}\sum_{j=1}^{T}\lambda_j$

. .

$=(\lambda_t-\frac{1}{T}\sum_{j=1}^{T}\lambda_j)-\frac{1}{N}(N \lambda_t -N \frac{1}{T}\sum_{j=1}^{T}\lambda_j)+\text{other demeaned terms unrelated to year FE}$

. .

distribute the $\frac{1}{N}$

. .

$=\underbrace{(\lambda_t-\frac{1}{T}\sum_{j=1}^{T}\lambda_j)-(\lambda_t-\frac{1}{T}\sum_{j=1}^{T}\lambda_j)}_\text{=0}+\text{other demeaned terms unrelated to year FE}$

$=\text{other demeaned terms unrelated to year FE}$

• Thanks for answer. You explained panel fixed effects and time fixed effects in a separate/additive/stepwise manner, which is what confuses me in the first place. Denote the set of panel dummies as $P$ and the set of time dummies as $Q$. What you've described is equivalent to demeaning $Y$ and $X$ within panel first (yielding $\tilde Y$ and $\tilde X$), and then demean $\tilde Y$ and $\tilde X$ within year. This procedure does not seem equivalent to model 3... – Paul Dec 7 '16 at 4:50
• Frisch-Waugh-Lovell Theorem says that for model 3, we can project $Y$, $X$, and $Q$ on $P$ respectively, and work with the residuals $\tilde Y$, $\tilde X$, and $\tilde Q$. The second step is to project $\tilde Y$ and $\tilde X$ on $\tilde Q$. This second step seems to be different from demeaning within year in the stepwise case. Or maybe it is the same? – Paul Dec 7 '16 at 4:51
• Thanks to FWL the order of the demeaning does not impact the final result. – Hessian Dec 7 '16 at 4:56
• that's right. But I was comparing projecting on $Q$ and projecting on $\tilde Q$, where $Q$ is the set of time dummies, and $\tilde Q$ is the panel-demeaned time dummies. – Paul Dec 7 '16 at 5:28
• @Paul edited answer above to show how, starting with panel demeaned time dummies, the year demeaning wipes out all the year FE. – Hessian Dec 7 '16 at 18:31

Interpretation:

Model 1: Within the same unit, $y_{it}-y_{is}$ is expected to be $(x_{it}-x_{is})\beta_1$. That is, within a unit, between two periods with different $x$, $y$ is expected to differ by the difference in $x$ times $\beta_1$.

Model 2: In the same period, $y_{it}-y_{jt}$ is expected to be $(x_{it}-x_{jt})\beta_2$. That is, in a period, between two units with different $x$, $y$ is expected to differ by the difference in $x$ times $\beta_2$.

Model 3: Within unit $i$, $y_{it}-y_{is}$ is expected to be $(x_{it}-x_{is}) \beta_3 + (\gamma_t - \gamma_s)$, and within unit $j$, $y_{jt}-y_{js}$ is expected to be $(x_{jt}-x_{js})\beta_3 + (\gamma_t - \gamma_s)$. So if $x_{it}-x_{is} = x_{jt}-x_{js}$, then the expected differences in $y$ are the same for both units, and $(y_{it}-y_{is})-(y_{jt}-y_{js})$ is expected to be $[ (x_{it}-x_{is}) - (x_{jt}-x_{js})] \beta_3$. How can I interpret this math verbosely? Let me try, though I'm not sure I will succeed. Suppose that unit $i$'s $x$ differs by 1 across two periods, so does unit $j$'s $x$ across the same two periods. Then those two units' $y$ values are expected to differ across the two periods by the same amount. If the two units have different differences in $x$ over the two periods, then the expected differences in $y$ differ by $\beta_3$ times the difference in the differences in $x$. Yes, this is like DID (difference-in-differences).

• Thanks! How would you answer the question "what variation is used to estimate $\beta_3$?" I ask because this kind of question is frequently asked in workshops, but I don't always hear satisfactory answers. – Paul Dec 13 '16 at 1:25
• Sorry I thought that the question was answered by Hessian and yourself, Paul. That's the $\tilde{x}_{it}$ in your question. There should be variation across both $i$ and $t$. Common trend over time is regarded as no change; cross-unit variation with no temporal variation is regarded as nothing. – chan1142 Dec 13 '16 at 8:22
• Thanks. I was trying to solicit your version. Sounds good. – Paul Dec 13 '16 at 17:06