The difference between DID and fixed effect model It is said that the DID (difference-in-difference) is a special case of the fixed-effect model. However, in my understanding, they solve different problems:
In the case of DID, there is an unobserved confounder who is time-varying. Based on the common trend assumption, we demean its effect by taking the difference in difference.
However, in the case of the fixed-effect model, the unobserved confounder is time-invariance, which is one of the most important assumptions of the fixed-effect model.
May someone clarifies for me?
 A: Let's begin with an understanding of the standard fixed effects estimator before extending our intuition to make sense of how difference-in-differences (DD) estimation may offer any improvements.
Assume you have repeated observations of individuals across time. For example, let’s say we want to estimate the following model:
$$
y_{it} = X’_{it}\beta + \alpha_{i} + u_{it},
$$
where $\alpha_{i}$ represents a fixed parameter. We can define this fixed effect as the individual heterogeneity that is different across individuals but stable over time. Some of these time-invariant variables may be observed and known to a researcher (e.g., sex, race, ethnicity, etc.); some may be unobserved yet still known to be a source of individual heterogeneity (e.g., innate ability, stable personality characteristics, temperament, etc.); and, well, some of the other stable factors may be unobserved and unbeknownst to a researcher. In a fixed effects specification, demeaning removes (i.e., ‘sweeps out’) the fixed effect, $\alpha_{i}$. The average of a time-invariant variable is the time-invariant variable, and so demeaning 'wipes out' (subtracts out) the stable characteristics of individuals that differ across individuals but are stable over time.

*

*Who is in control of a change in treatment/exposure status?

It is the changes individuals experience in life that motivate us to use a fixed effects approach. However, these decisions are typically under the control of the individual. People change jobs; they get married; they earn more money; they change their political affiliation; they move; they have children; they become unionized; they join the military; they drop out of school; they get arrested. In practice, we wish to understand how this change in people's lives (treatment/exposure) affects the change in another variable (outcome). For example, does more education reduce infant mortality? Does one's union status affect wages? But, when changes in treatment/exposure status are under the control of the individual units we observe over time, then concerns about unobserved factors that are correlated with changes in treatment/exposure status remain.
Note, the foregoing equation could also be viewed as having two sources of error: $\alpha_{i}$ and $u_{it}$. The idiosyncratic, time-varying factors embedded in $u_{it}$ typically motivates researchers to acquire a control group. Think about the multitude of unobserved time-varying factors that might influence individuals’ decisions across time. Often times, the individual is in control of these decisions, not the researcher.

*

*Limitation of fixed effects?

Fixed effects identifies effects for individuals who do change. But, why do some people change, and not others? This leads to one of the major drawbacks of fixed effects: it cannot investigate the effects of a within-unit change in the independent variable on the within-unit change in some outcome variable for individuals who do not experience a change. Simply put, a fixed effects model only uses within-unit variation. The model identifies effects within units, and it is constant within the unit. This is a special kind of control, as we controlled for the stable characteristics that stably made you, you. The counterfactual in a fixed effects specification is the treated/exposed individual. That is, individuals act as controls for themselves. Again, the model does not address changes over time.
One method to overcome time-varying confounding is to collect data on individuals or entities (e.g., firms, counties, states, etc.) not exposed to the treatment/exposure of interest. This allows you to partition units into a treatment or control condition. Now you can observe treated and untreated groups as they move through time. The external control group is the counterfactual for what would have occurred to a treated/exposed group in the absence of treatment exposure.
Enter the DD model. Under a DD specification, we are measuring the before-and-after change in the outcome of the treatment group relative to the before-and-after change in the outcome of the control group. It is important to note a subtle distinction here. In DD settings, the change in treatment exposure is typically determined outside of the unit of observation. For example, a policy/law may be introduced at the county/state level and affect a particular group of individuals/entities within that state. Often times, these policies/laws don't go into effect everywhere. Thus, these 'non-adopters' can serve as a suitable counterfactual. This is one of the attractive features of DD models; you can exploit this source of variation.

It is said that the DID (difference-in-difference) is a special case of the fixed-effect model

Correct. Texts will often refer to DD as a “special case” of fixed effects. Both fixed effects and DD models include “fixed effects” for individuals or higher-level entities (e.g., firms, counties, states, etc.) that control for factors—both observed and unobserved—that are constant over time within those individuals or higher-level entities. Again, DD methods require at least some units to be unexposed to the treatment/policy/intervention. And, only information at the group level is required for identification of your treatment effect.
Here is the canonical DD setup with two groups and two periods:
$$
y_{ist} = \alpha + \gamma T_{s} + \lambda d_{t} + \delta(T_{s} \cdot d_{t}) + \epsilon_{ist},
$$
where we may observe individual/entity $i$, in state $s$, at time period $t$. This is an example where data is ‘aggregated up’ to a higher-level, where some states introduce a new law/policy and others do not. You could estimate this equation with dummies for all groups (states), but the dummies (i.e., “fixed effects”) will absorb the treatment variable. This becomes clearer when you have different states introducing laws/policies at different times. The generalization of the foregoing equation would include dummies for each state and each time period but is otherwise unchanged. For example,
$$
y_{ist} = \gamma_{s} + \lambda_{t} + \delta D_{st} + \epsilon_{ist},
$$
where the new treatment dummy $D_{st}$ is the same as before $(T_{s} \cdot d_{t})$. Note, $\gamma_{s}$ denotes state fixed effects. The inclusion of dummy variables for all states is algebraically equivalent to estimation in deviations from means. Due to the inclusion of fixed effects at this higher-level of aggregation, DD methods do allow for some selection on the basis of time-invariant unobserved characteristics.
I hope this gave you a better understanding of why DD is a special case of fixed effects. As for establishing causality, fixed effects doesn’t always cut it. It’s up to you to show that the policy/treatment change is plausibly unconfounded.
