# Testing parallel trends in staggered difference-in-differences

When creating the time dummies, what is the value for the control group? Always $$0$$? Also, I standardized the time dimension ($$t=1$$ in the treatment year, $$t=0$$ is the year before the treatment, $$t=-1$$ is two years before the treatment, $$t=2$$ is one year after the treatment, etc.). But again: how do I use the standardized time dimension for the control group? Stata also does not seem to accept that the time dimension goes to negative values. Is there a way to work around this but still capture time $$0$$ as the base year and then $$2$$ years before and then $$2$$ years after (i.e., leads and lags)?

• Welcome. How many time periods do you have? Do you want to saturate the model with a full series of lead and lag indicators, or just two periods before and two periods after? May 7, 2021 at 0:57
• Hi Thomas, thank you for reaching out! And sorry for the brevity of the question, I initially wanted to write it under a post referring to a similar topic, was not aware that was not allowed. Anyway, to your questions; even though my data set includes time horizon 2000-2019, I believe I read somewhere that too many time periods can weaker the model? hence I was thinking about including "only" 2-3 leads and 2-3 lags. May 7, 2021 at 7:47
• How long is treatment in place? Or should I say, when does treatment start for the early-adopter entities? May 7, 2021 at 8:07
• Earliest treatment is in year 2004 then in 2010, 2014, 2015 (4 treatment years in total) May 7, 2021 at 8:20

When creating the time dummies, what is the value for the control group? Always 0?

Yes.

The timing of the intervention isn't standardized. In fact, the onset of treatment is staggered over time. That is, some entities start early, while others start late. Some treatments may even reverse. In this setting, the "generalized" difference-in-differences estimator must be used. The treatment dummy used to estimate your treatment effect should 'turn on' (i.e., switch from 0 to 1) if a unit is treated and only during the precise policy adoption years, 0 otherwise. Units never espousing the treatment should be coded as 0 for the entire observation period. To be clear, it should equal 0 from 2000–2019.

But again: how do I use the standardized time dimension for the control group?

You don't.

Instantiating a variable delineating pre- versus post-treatment is inappropriate in this setting. The term "post-treatment" is defined differently across units. Because of this, we cannot assume control units would have received treatment in a particular year.

Stata also does not seem to accept that the time dimension goes to negative values.

It appears you created a variable denoting each unit's time to event, where each unit is $$t$$ periods relative to the last pre-treatment year (i.e., $$t = 0$$). I can see how this breeds confusion especially if you have a subset of non-adopter units. In my opinion, I only recommend this approach in settings where all entities enter into treatment. The variable denoting the relative periods is allowed to enter the model as a series of time dummies reflecting the observed onset of treatment. Stata cannot handle negative values assigned to a categorical variable. Adding a numeric constant to the variable is a cheap trick to get around it. Suppose I add 10 to the sequence of integers in the first line. The last pre-treatment year is 10.

-3 -2 -1  0  1  2  3
7  8  9 10 11 12 13


We can't normalize the time dimension around some event where a suitable counterfactual exists. Oftentimes we don't know when the subset of non-adopters would have entered into treatment.

A couple of visuals might help. The data frame that follows shows 3 units observed over 20 years. Appended is a variable $$R_{it}$$ which delineates the relative periods before and after treatment. The variable $$T_{it}$$ is the treatment dummy. Note how it doesn't demarcate a specific treatment group. It simply 'turns on' (i.e., switches from 0 to 1) once a particular treated entity enters into treatment, 0 otherwise. As indicated in your post, treatment starts when $$t = 1$$, and the 'time to event' varies across units. The year of exposure is as follows:

• Unit 1 adopts in 2011
• Unit 2 adopts in 2012
• Unit 3 adopts in 2013

Note how all units undergo treatment. The "treatment effect" is identified solely based upon variation in treatment timing. To estimate leads and lags of treatment, software is certainly capable of 'dummying out' the individual relative period dummies. Again, I only recommend standardizing the time dimension in this way in settings where all entities eventually become treated.

$$\begin{array}{ccc} unit & time & R_{it} & T_{it} \\ \hline 1 & 2000 & -K & 0 \\ 1 & \vdots & \vdots & \vdots \\ 1 & 2008 & -2 & 0 \\ 1 & 2009 & -1 & 0 \\ 1 & 2010 & \ \ \ 0 & 0 \\ 1 & 2011 & \ \ \ 1 & 1 \\ 1 & 2012 & \ \ \ 2 & 1 \\ 1 & 2013 & \ \ \ 3 & 1 \\ 1 & 2014 & \ \ \ 4 & 1 \\ 1 & 2015 & \ \ \ 5 & 1 \\ 1 & \vdots & \vdots & \vdots \\ 1 & 2019 & \ \ \ L & 1 \\ \hline 2 & 2000 & -K & 0 \\ 2 & \vdots & \vdots & \vdots \\ 2 & 2008 & -3 & 0 \\ 2 & 2009 & -2 & 0 \\ 2 & 2010 & -1 & 0 \\ 2 & 2011 & \ \ \ 0 & 0 \\ 2 & 2012 & \ \ \ 1 & 1 \\ 2 & 2013 & \ \ \ 2 & 1 \\ 2 & 2014 & \ \ \ 3 & 1 \\ 2 & 2015 & \ \ \ 4 & 1 \\ 2 & \vdots & \vdots & \vdots \\ 2 & 2019 & \ \ \ L & 1 \\ \hline 3 & 2000 & -K & 0 \\ 3 & \vdots & \vdots & \vdots \\ 3 & 2008 & -4 & 0 \\ 3 & 2009 & -3 & 0 \\ 3 & 2010 & -2 & 0 \\ 3 & 2011 & -1 & 0 \\ 3 & 2012 & \ \ \ 0 & 0 \\ 3 & 2013 & \ \ \ 1 & 1 \\ 3 & 2014 & \ \ \ 2 & 1 \\ 3 & 2015 & \ \ \ 3 & 1 \\ 3 & \vdots & \vdots & \vdots \\ 3 & 2019 & \ \ \ L & 1 \\ \end{array}$$

The previous data frame allows for any number of $$K$$ leads and $$L$$ lags. The number of relative pre- and post-periods will vary across units. For instance, the late-adopters will invariably have more relative pre-policy periods than those treated much earlier.

But suppose you have a subset of non-adopters. What is their relative time to treatment? By "non-adopters" I mean units never exposed to treatment in any time period (i.e., control units). In short, we can't impute their time to exposure because the intervention is switching on, and possibly off, at different times within different entities. In my opinion, there's no computationally easy method to estimate lead and/or lag indicators in settings where the timing of treatment isn't well-defined and where a subset of units were left untreated.

The next example is a staggered design, but now the treatment only affects a subset of units. In other words, some units never receive treatment. The precise start date for the non-adopters is largely unknown. In scenarios where we want to instantiate a lead or a lag, then I recommend instantiating the relative lead and/or lag indicators manually.

In the example data frame that follows we have 3 units observed over 20 years. Here, unit 1 was precluded from receiving treatment. This is the "always 0" control unit(s) mentioned earlier. Note the column of values under $$T_{it}$$; unit 1 equals 0 throughout the entire observation period. The treatment histories are as follows:

• Unit 1 is not eligible for the treatment (i.e., control unit)
• Unit 2 adopts in 2012
• Unit 3 adopts in 2013

Now suppose you want to estimate some leads and lags. The indicator $$d^{+1}_{it}$$ is the immediate effect of treatment. It is the first adoption year. Depending upon the discipline, some may label $$d^{0}_{it}$$ as the immediate effect of treatment, with each subsequent period referred to as lagged effects. It doesn't really matter which period is labeled as the initial adoption year. Just be consistent! I also binned the final lag (i.e., $$d^{+\bar{3}}_{it}$$). It simply switches on in the third period after treatment and stays on. You don't have to do this in practice, but you should think about how to model the endpoint. You could also estimate separate effects in all post-periods. It's up to you!

$$\begin{array}{ccc} unit & time & T_{it} & d^{-2}_{it} & d^{-1}_{it} & d^{0}_{it} & d^{+1}_{it} & d^{+2}_{it} & d^{+\bar{3}}_{it} \\ \hline 1 & 2000 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\ 1 & 2008 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2009 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2010 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2011 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2012 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2013 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2014 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 2015 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 1 & 2019 & 0 & 0 & 0 & 0 & 0 & & 0 \\ \hline 2 & 2000 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 2 & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 2 & 2008 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 2 & 2009 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 2 & 2010 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 2 & 2011 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 2 & 2012 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 2 & 2013 & 1 & 0 & 0 & 0 & 0 & 1 & 0 \\ 2 & 2014 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ 2 & 2015 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ 2 & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 2 & 2019 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ \hline 3 & 2000 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 3 & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 3 & 2008 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 3 & 2009 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 3 & 2010 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 3 & 2011 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 3 & 2012 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 3 & 2013 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 3 & 2014 & 1 & 0 & 0 & 0 & 0 & 1 & 0 \\ 3 & 2015 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ 3 & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ 3 & 2019 & 1 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{array}$$

As an aside, it's also quite common to observe the individual post-treatment effects expressed as follows: $$d^{-1}_{it}, d^{-2}_{it}, d^{-3}_{it},..., d^{-L}_{it}$$, where the negative integers represent the lags. Again, just keep your notation consistent!

Remember you could proceed in many ways. You could estimate a finite number of leads and/or lags, or trace out the full dynamics of exposure by saturating the model. If the treatment is transient, then incorporating a full series of time indicators is very demanding. Moreover, some units may opt out of the treatment over time. As you move farther and farther away from the first adoption year, you may have less and less data to estimate your lags. This isn't usually a problem in practice, but you may find that the fifth, sixth, and seventh lags are less precisely estimated.

• Thank you so much Thomas for taking the time! Your answer addressed exactly the practical use of the leads and lags that I was not able to find anywhere else. I will definitely follow your comments May 13, 2021 at 9:20
• No problem. If this helped please consider giving it a check. If not you can always follow up with me here. May 13, 2021 at 16:38