<p>This question is related to a <a href="https://stats.stackexchange.com/questions/455986/panel-data-diff-in-diff-and-the-pattern-of-the-binary-treatment-indicator/457575#457575">post</a> I addressed on CrossValidated. The &quot;generalized&quot; difference-in-differences (DiD) estimator is amenable to settings with multiple groups and multiple exposure periods. Take the following specification:</p>
<p><span class="math-container">$$
y_{it} = \gamma_{i} + \lambda_{t} + \delta T_{it} + \epsilon_{it},
$$</span></p>
<p>where <span class="math-container">$\gamma_{i}$</span> and <span class="math-container">$\lambda_{t}$</span> denote <em>unit</em> (i.e., individual, entity, county, state, etc.) and <em>time</em> (i.e., day, month, year, etc.) fixed effects, respectively. You may also see this referenced as a ‘two-way’ fixed effects estimator. The variable <span class="math-container">$T_{it}$</span> is a treatment dummy, indexing the <span class="math-container">$i$</span> units affected by the policy/intervention during periods <span class="math-container">$t$</span>, 0 otherwise. In practice, <span class="math-container">$T_{it}$</span> can take on any pattern. Thus, it can more than handle intermittent exposure periods.</p>
<p>Your main policy dummy <span class="math-container">$T_{it}$</span> <em>is</em> 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, <span class="math-container">$T_{it}$</span> 'turns on' (i.e., equals 1) if two conditions are met: (1) the entity is in the treatment group <em>and</em> it is in the post-treatment period. Be careful because <span class="math-container">$T_{it}$</span> 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.</p>
<p>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 <em>trend</em> 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 <a href="http://economics.mit.edu/files/14964" rel="nofollow noreferrer">working paper</a>. In sum, while the &quot;generalized&quot; DiD estimator will work in your setting, you must be cognizant of the downsides of using this approach.</p>
<p>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.</p>
<p>You might also find this paper by <a href="http://web.mit.edu/insong/www/pdf/FEmatch-twoway.pdf" rel="nofollow noreferrer">Imai and Kim 2020</a> an interesting read.</p>

CC BY-SA 4.0
2020-09-19T19:41:11.453Z
2021-06-22T06:13:33.317Z
2021-06-22T06:13:33.317Z
Thomas Bilach
<p>I have a <strong>high-frequency panel dataset</strong> on the order of <span class="math-container">$i=150$</span> and <span class="math-container">$t=5000$</span>. I am interested in studying the causal impact of a treatment with the following characteristics:</p>

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

<p>Here is an example of treatment over time (where black indicates treated, and the y axis contains a row for each unit <span class="math-container">$i$</span>):</p>

<p><a href="https://i.sstatic.net/kyiIn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kyiIn.png" alt="enter image description here"></a></p>

<p>Here is an example of a treated unit (black) and a comparison unit (blue) when treatment is administered (red), where the <span class="math-container">$y$</span> axis is an outcome of interest:</p>

<p><a href="https://i.sstatic.net/ap8JB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ap8JB.png" alt="enter image description here"></a></p>

<p>Coming from the perspective of causal inference / program evaluation, it seems like the natural approach is to use some sort of <strong>difference-in-differences</strong> 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. </p>

<ul>
<li>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. </li>
<li>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 <span class="math-container">$i$</span> and <span class="math-container">$t$</span>.</li>
</ul>

<p>My question is:</p>

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

<p>Thanks for any guidance you can provide.</p>

CC BY-SA 4.0
2019-01-15T20:48:53.257Z
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 (https://doi.org/10.1162/rest.89.2.221), (2) Inferring causal impact using Bayesian structural time-series models (https://ai.google/research/pubs/pub41854), (3) Semiparametric Estimates of Monetary Policy Effects: String Theory Revisited (https://doi.org/10.1080/07350015.2016.1204919)
Andrew M
CC BY-SA 4.0
2019-01-15T21:06:20.760Z
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
<applied-econometrics><time-series><paneldata><causality>
Difference-in-differences with long time horizon and repeated treatments
atkat12
# Difference-in-differences with long time horizon and repeated treatments

(Asked by: username_0 on 2019-01-15)

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$):

[![enter image description here](https://i.sstatic.net/kyiIn.png)](https://i.sstatic.net/kyiIn.png)

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:

[![enter image description here](https://i.sstatic.net/ap8JB.png)](https://i.sstatic.net/ap8JB.png)

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.

**Tags:** applied-econometrics, time-series, paneldata, causality

> **Comments:**
> **username_1**: 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 (https://doi.org/10.1162/rest.89.2.221), (2) Inferring causal impact using Bayesian structural time-series models (https://ai.google/research/pubs/pub41854), (3) Semiparametric Estimates of Monetary Policy Effects: String Theory Revisited (https://doi.org/10.1080/07350015.2016.1204919)  
> **username_0**: Thanks @username_1 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.  

---

## 1 answers

### Answer by username_2 on 2020-09-19. Score: 4 | Accepted answer

This question is related to a [post](https://stats.stackexchange.com/questions/455986/panel-data-diff-in-diff-and-the-pattern-of-the-binary-treatment-indicator/457575#457575) 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](http://economics.mit.edu/files/14964). 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 paper by [Imai and Kim 2020](http://web.mit.edu/insong/www/pdf/FEmatch-twoway.pdf) an interesting read.


---

