# What is the reasonable approach to deal with DiD for multiple time periods and groups? (staggered DiD)

Two-way fixed effect (TWFE) has been used for 2 decades for examining the change of some particular objectives after an event, or "generalized Difference-in-Differences (DiD)".

However, Goodman, 2018, Imai and Kim, 2020 and Chaisemartin,2020 and other papers documented that it is an appropriate design, especially for staggered DiD (different countries implement the same laws in different time periods). The reason is because of the heterogeneous impact of laws over time.

Asking for solution: I am wondering what is the solution for the TWFE, is it killed from now, so now what should we do if we want to conduct the DiD testing with multiple time periods and groups?

For example, in a note, Bacon,2019 says

The DD specification—estimating the coefficient a single post-treatment dummy—is a bad idea when your treatment effects vary over time (get bigger with time since treatment). In this case, just summarize your findings in a different way—event-study or a linear trend-break, for instance.

What does he mean then?

Suppose the original TWFE equation was something like the following: $$y_{nt} = \alpha_n + \mu_t + d_{nt}\beta + u_{nt}$$ where $$n$$ is the index for units (e.g., individuals, firms) and $$t$$ indexes time. $$\alpha_n$$ is the usual unit fixed effect, while $$\mu_t$$ is an intercept for the time period (often called a "time fixed effect," but some people don't like that term). $$d_{nt}$$ is the binary indicator of treatment (i.e., $$d_{nt} = 1$$ if unit $$n$$ treated in time period $$t$$, otherwise $$d_{nt} = 0$$). Finally, $$u_{nt}$$ is the residual.

From your quote, Goodman-Bacon (they are the same person) suggests an event-study design as a possible alternative to the TWFE when there is staggered treatment. This is confirmed on the FAQ from Goodman-Bacon's website (see the "2. “Should I do an event-study?” where Goodman-Bacon discusses the benefits of an event-study design vs. TWFE).

An event-study design can be written down as follows. Let $$s_n$$ denote the first time period where unit $$n$$ is treated (i.e., the smallest $$t$$ such that $$d_{nt} = 1$$). We require that once $$d_{nt} = 1$$ it can never revert back to $$0$$. The equation to estimate is then something like

$$y_{nt} = \alpha_n + \mu_t + \sum_{h=-\infty}^{\infty} \mathbb{I}(t = s_n + h) \beta_h + u_{nt}$$ so that $$\beta_h$$ is the "effect" of treatment $$h$$ periods after treatment (negative $$h$$ indicate before treatment). Thus,

1. $$\beta_0$$ is the immediate effect of treatment
2. $$\beta_1$$ is the effect of treatment 1 period later
3. and so on...

Unlike TWFE, this allows the effect of treatment to vary over time (the issue bolded in the question).

In practice, you can estimate these coefficients by including sufficiently many leads and lags of the treatment indicator $$d_{nt}$$ in your formula/design matrix. Note that you don't actually estimate infinitely many $$\beta_h$$ values; how many you need depends on how soon the first unit is treated and how late the last unit is treated.

This paper by Sun and Abraham is cited by Goodman-Bacon and discusses the event study design in much greater depth.

• It seems that what you are doing here is similar to what is called "coefficient plotting" from this answer. Are they identical then? Jul 9 at 5:18
• "Note that you don't actually estimate infinitely many $\beta_h$ values; how many you need depends on how soon the first unit is treated and how late the last unit is treated.", could you please help me to clarify this part more? about how many $\beta_h$ values Jul 9 at 5:19
• @BeautifulMindset yes, a coefficient plot in this context is usually a plot of the estimated $\beta_h$ values + intervals. Sometimes you will just see them referred to as the lead or lag coefficients. At most, you only need to estimate as many $\beta_h$ values as there are possible lead and lag values of the treatment indicator $d_{nt}$ in the dataset. However, it's not uncommon to group leads or lags beyond $s_n \pm 3$ together (as in the coefficient plot link you sent) since those higher lead/lag coefficients would have to be estimated from a smaller and smaller sample size.
– Cat
Jul 9 at 7:15
• Nice explanation, @Cat. To add, I may bin (i.e., group) a lead/lag if I don't suspect a dynamic response beyond the endpoint. In other words, effects may vary in between the interval, but be constant beyond. Jul 10 at 19:44