<blockquote>
  <p>what exactly is the variation used in model 3 with both unit and time
  dummies?</p>
</blockquote>

<p>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. </p>

<blockquote>
  <p>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".</p>
</blockquote>

<p>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. <strong>Individual fixed effects in the model mean that any source of bias must be time varying</strong>. 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.</p>

<p>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. </p>

<p>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</p>

<ol>
<li>be time varying</li>
</ol>

<p>and</p>

<ol start="2">
<li>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$.)</li>
</ol>

<p>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.</p>

<p>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$. </p>

<p>Initially you do the panel demeaning, which creates the transformed variable </p>

<p>$\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}$.</p>

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

<p>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}$.</p>

<p>$=\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}$</p>

<p>.
.</p>

<p>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$</p>

<p>.
.</p>

<p>$=(\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}$</p>

<p>.
.</p>

<p>distribute the $\frac{1}{N}$</p>

<p>.
.</p>

<p>$=\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}$</p>

<p>$=\text{other demeaned terms unrelated to year FE}$</p>

CC BY-SA 3.0
2016-12-07T04:50:18.883Z
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
CC BY-SA 3.0
2016-12-07T04:51:17.907Z
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
CC BY-SA 3.0
2016-12-07T04:56:40.253Z
Thanks to FWL the order of the demeaning does not impact the final result.
Hessian
CC BY-SA 3.0
2016-12-07T05:28:36.730Z
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
CC BY-SA 3.0
2016-12-07T18:31:38.457Z
@Paul edited answer above to show how,  starting with panel demeaned time dummies, the year demeaning wipes out all the year FE.
Hessian
CC BY-SA 3.0
2016-12-10T16:09:14.803Z
@Paul Still curious if my new answer edits addresses your question...
Hessian
CC BY-SA 3.0
2016-12-11T03:59:38.807Z
Sorry about the delay. Adopting your notation, using two dots above to indicated panel-demeaned variables, model 3 is equivalent to $\ddot y=\ddot\lambda_t+\ddot X_{it}\beta+\ddot \epsilon_{it}$. Note that the time dummies $\ddot \lambda_t$ has also been transformed. I know $\ddot y = \lambda_t+\ddot X_{it}\beta + \ddot \epsilon_{it}$ is equivalent to $\dddot y = \dddot X_{it}\beta + \dddot \epsilon_{it}$. What I was trying to ask in previous comments is that with the transformed time dummies, is the equation still equivalent to $\dddot y = \dddot X_{it}\beta + \dddot \epsilon_{it}$?
Paul
CC BY-SA 3.0
2016-12-13T01:49:29.983Z
It's probably obvious to you but I missed it: because the time dummies are linearly independent of the panel dummies, $\ddot y_{it} = \ddot \lambda_t + \ddot X_{it}\beta + \ddot \epsilon_{it}$ is equivalent to $\ddot y_{it} = \lambda_t + \ddot X_{it}\beta + \ddot \epsilon_{it}$. So demeaning with time FE in the second step is legitimate.
Paul
CC BY-SA 3.0
2016-12-06T21:21:07.033Z
2016-12-07T18:48:25.813Z
2016-12-07T18:48:25.813Z
Hessian
<p>Interpretation:</p>

<p><strong>Model 1:</strong> Within the <em>same unit</em>, $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$.</p>

<p><strong>Model 2:</strong> In the <em>same period</em>, $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$.</p>

<p><strong>Model 3:</strong> 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).</p>

CC BY-SA 3.0
2016-12-13T01:25:13.967Z
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
CC BY-SA 3.0
2016-12-13T08:22:26.700Z
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
CC BY-SA 3.0
2016-12-13T17:06:11.837Z
Thanks. I was trying to solicit your version. Sounds good.
Paul
CC BY-SA 3.0
2016-12-11T12:54:58.893Z
2016-12-11T12:54:58.893Z
chan1142
<p>Suppose I have a panel data with N units and T time periods.</p>

<ul>
<li>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$.</li>
<li>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$.</li>
<li>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 <em>not</em> use the within-unit within-time variation in $x$, because no such variation exists in the dataset.</li>
</ul>

<p>My question is: what exactly is the variation used in model 3?</p>

<p>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$.</p>

<p>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 <a href="https://www.wikiwand.com/en/Ceteris_paribus" rel="nofollow noreferrer">ceteris paribus</a> interpretation, meaning we are comparing within groups with same values of x. See <a href="https://stats.stackexchange.com/a/78830/44293">this answer</a> 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".</p>

<econometrics><regression><paneldata>
interpretation: linear regressions with both unit dummies and time dummies
Paul
# interpretation: linear regressions with both unit dummies and time dummies

(Asked by: username_0 on 2016-12-06)

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](https://www.wikiwand.com/en/Ceteris_paribus) interpretation, meaning we are comparing within groups with same values of x. See [this answer](https://stats.stackexchange.com/a/78830/44293) 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".

**Tags:** econometrics, regression, paneldata

---

## 2 answers

### Answer by username_1 on 2016-12-06. Score: 1 | Accepted answer

> 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

2. 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}$

> **Comments:**
> **username_0**: 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...  
> **username_0**: 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?  
> **username_1**: Thanks to FWL the order of the demeaning does not impact the final result.  
> **username_0**: 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.  
> **username_1**: @Paul edited answer above to show how,  starting with panel demeaned time dummies, the year demeaning wipes out all the year FE.  
> **username_1**: @Paul Still curious if my new answer edits addresses your question...  
> **username_0**: Sorry about the delay. Adopting your notation, using two dots above to indicated panel-demeaned variables, model 3 is equivalent to $\ddot y=\ddot\lambda_t+\ddot X_{it}\beta+\ddot \epsilon_{it}$. Note that the time dummies $\ddot \lambda_t$ has also been transformed. I know $\ddot y = \lambda_t+\ddot X_{it}\beta + \ddot \epsilon_{it}$ is equivalent to $\dddot y = \dddot X_{it}\beta + \dddot \epsilon_{it}$. What I was trying to ask in previous comments is that with the transformed time dummies, is the equation still equivalent to $\dddot y = \dddot X_{it}\beta + \dddot \epsilon_{it}$?  
> **username_0**: It's probably obvious to you but I missed it: because the time dummies are linearly independent of the panel dummies, $\ddot y_{it} = \ddot \lambda_t + \ddot X_{it}\beta + \ddot \epsilon_{it}$ is equivalent to $\ddot y_{it} = \lambda_t + \ddot X_{it}\beta + \ddot \epsilon_{it}$. So demeaning with time FE in the second step is legitimate.  

---

### Answer by username_2 on 2016-12-11. Score: 1

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).

> **Comments:**
> **username_0**: 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.  
> **username_2**: 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.  
> **username_0**: Thanks. I was trying to solicit your version. Sounds good.  

---

