# Difference-in-differences with long time horizon and repeated treatments

I have a high-frequency panel dataset on the order of $$i=150$$ and $$t=5000$$. I am interested in studying the causal impact of a treatment with the following characteristics:

• The same unit can be treated several times
• Different units can be treated at different times
• The effect of the treatment does not spill over beyond the current time period

Here is an example of treatment over time (where black indicates treated, and the y axis contains a row for each unit $$i$$):

Here is an example of a treated unit (black) and a comparison unit (blue) when treatment is administered (red), where the $$y$$ axis is an outcome of interest:

Coming from the perspective of causal inference / program evaluation, it seems like the natural approach is to use some sort of difference-in-differences flavored model, where treated units act as controls for untreated units at different points in time. However, I am struggling to find an analogy in the literature.

• Typically, in example diff-and-diff models I have seen, units are treated only once, control units are never treated, and the treatment persists into the future.
• Also, with such a long time horizon autocorrelation seems problematic, and time-varying, individual-level seasonal fixed effects are likely necessary. Consequently, I expect that I need to make some modifications to the basic panel approach of including fixed effects for $$i$$ and $$t$$.

My question is:

1. Have people used diff-in-diff analyses with similar datasets? If so, could you point me to some sample papers?
2. Is there an alternative approach that would be be better suited to this setting? If so, are there relevant references? (e.g. from macro, finance, time series literature).

Thanks for any guidance you can provide.

• I don't know this literature all that well but here are three papers that might help guide you in the right direction: (1) Inference with Difference-in-Differences and Other Panel Data (doi.org/10.1162/rest.89.2.221), (2) Inferring causal impact using Bayesian structural time-series models (ai.google/research/pubs/pub41854), (3) Semiparametric Estimates of Monetary Policy Effects: String Theory Revisited (doi.org/10.1080/07350015.2016.1204919) – Andrew M Jan 15 '19 at 20:48
• Thanks @AndrewM for the papers! I will investigate those further and answer my own question if I come up with a solution. @ caverac thanks also for the suggestion, I am working in the context of econ so I thought this community would be most relevant, but if I don't get an answer I will try to migrate to CS or Stats. – atkat12 Jan 15 '19 at 21:06

This question is related to a post I addressed on CrossValidated. The "generalized" difference-in-differences (DiD) estimator is amenable to settings with multiple groups and multiple exposure periods. Take the following specification:

$$y_{it} = \gamma_{i} + \lambda_{t} + \delta T_{it} + \epsilon_{it},$$

where $$\gamma_{i}$$ and $$\lambda_{t}$$ denote unit (i.e., individual, entity, county, state, etc.) and time (i.e., day, month, year, etc.) fixed effects, respectively. You may also see this referenced as a ‘two-way’ fixed effects estimator. The variable $$T_{it}$$ is a treatment dummy, indexing the $$i$$ units affected by the policy/intervention during periods $$t$$, 0 otherwise. In practice, $$T_{it}$$ can take on any pattern. Thus, it can more than handle intermittent exposure periods.

Your main policy dummy $$T_{it}$$ is your interaction term, but you must instantiate it manually to account for the different entities moving into and out of a treated status across time. Thus, $$T_{it}$$ 'turns on' (i.e., equals 1) if two conditions are met: (1) the entity is in the treatment group and it is in the post-treatment period. Be careful because $$T_{it}$$ does not demarcate a precise treatment group. Rather, it a discrete indictor for adopter entities and only during those adopter periods. Any 'off' period of treatment should be coded 0.

The problem in your setting is you have a large number of treated units with staggered adoption periods, making it exceedingly difficult to demonstrate a common trend across groups. Centering all units on their adoption date is insufficient as a subset of treated units have multiple treatment regimes. I wonder if you could work on subsets of your data where most treated entities enter into the treatment epoch at more or less the same time. However, this might be difficult with repeated, transient post-exposure periods. Pre-trends might also be violated in settings with irregular exposure periods and heterogeneous treatment effects, a point noted in a recent working paper. In sum, while the "generalized" DiD estimator will work in your setting, you must be cognizant of the downsides of using this approach.

I have previously evaluated policies that were introduced and repealed on several occasions over time. The only difference is the policy dummy turned 'on' and 'off' at the same time for all units. While a different subset of entities were treated in each iteration of the policy, the exposure period was standardized. Thus, I was able to focus on subsets of my panel and assess trend equivalence before each adoption period. I would be happy to share this research if it offers any further insight.

You might also find this working paper an interesting read.