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
- be time varying
and
- 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}$