3
$\begingroup$

I want to use difference-in-differences (DiD) to estimate a treatment effect. However, my problem is a little different from the standard DiD application in that:

  1. The items in the treatment group may start to receive the treatment at different times, e.g., some of the items start to be treated by day 1 and some by day 2.

  2. Once the items get treated, their status may switch between "treated" and "untreated", e.g., they may stay treated for some days and then become untreated for another few days, and so on.

Can I still use the DiD estimator? And if not, how do I need to make the adjustment to adapt for the above scenario?

$\endgroup$
1
  • $\begingroup$ Welcome. So you observe items (units) over days (time)? If I understand you correctly, some items move into and out of a “treated” status throughout your panel? $\endgroup$ Jan 9, 2021 at 7:09

1 Answer 1

2
$\begingroup$

The items in the treatment group may start to receive the treatment at different times, e.g., some of the items start to be treated at day 1 and some day 2.

Not a problem at all.

What you require is the generalized difference-in-differences (DiD) estimator. It accommodates irregular adoption periods. In other words, different units may enter into treatment at different times. This is often the case in practice, where some policy is rolled out to aggregate level entities (i.e., districts, counties, states, etc.) over a long time horizon.

My only concern is you state some items enter into treatment by day 1, while others enter into treatment by day 2. It is unclear whether day 1 is the first time period the item is observed in your panel or if you are referring to the first post-treatment period. If "day 1" is the beginning of your panel, then by design, the subset of early adopter items do not have a pre-treatment period; they begin as treated entities! This isn't so much a problem if a small subset of treated items start as treated. I will talk about other concerns related to identification and parallel trends later.

Once the items get treated, their status may switch between "treated" and "untreated", e.g., they may stay treated for some days and then become untreated for another few days, and so on.

Again, you can still proceed as recommended.

The generalized DiD estimator can accommodate periods of treatment withdrawal, even multiple treatment histories. I addressed some of the following points in this post, though some of them bear repeating. Here is the model:

$$ y_{it} = \gamma_i + \lambda_t + \delta D_{it} + \epsilon_{it} $$

where you observe your outcome $y$ for items $i$ ($i = 1, 2, 3,..., N)$ over days $t$ ($t = 1, 2, 3,...,T$). The parameters $\gamma_i$ and $\lambda_t$ denote fixed effects for items and days, respectively. Estimation is achieved via the inclusion of dummies for all $N - 1$ items and all $T - 1$ days. The variable $D_{it}$ is a dichotomous treatment variable, which 'turns on' (i.e., switches from 0 to 1) if the item is in the treatment group and is in a posttreatment period. Items moving out of a treated status must be coded to reflect periods of treatment withdrawal (i.e., switch from 1 to 0). Entities previously treated may receive a second or third or fourth wave of treatment, in which case the item should switch back on during the precise treatment days. This could happen for some items and not others.

I created a fake data frame below to outline this. My fictitious panel includes 3 units observed over 8 days, for a total of 24 item-day observations. I instantiated a treatment dummy which exhibits a staggered and intermittent pattern. In practice, the binary treatment indicator is amenable to irregular exposure patterns, making the generalized estimator very flexible for policy analysis. Here is a summary of each item's treatment history:

  • Item 1 is never treated (i.e., stays 'turned off' from days 1 through 8)
  • Item 2 adopts the first treatment early but is treated once (i.e., 'turns on' days 3 through 5)
  • Item 3 adopts the first treatment late but is treated twice (i.e.,' turns on' days 4 through 5, 'turns off' for day 6, then 'turns on' again days 7 through 8)

The treatment dummy $D_{it}$ should exist in your data frame as a single column. See the example below:

$$ \begin{array}{ccc} item & day & D_{it} \\ \hline I_1 & 1 & 0 \\ I_1 & 2 & 0 \\ I_1 & 3 & 0 \\ I_1 & 4 & 0 \\ I_1 & 5 & 0 \\ I_1 & 6 & 0 \\ I_1 & 7 & 0 \\ I_1 & 8 & 0 \\ \hline I_2 & 1 & 0 \\ I_2 & 2 & 0 \\ I_2 & 3 & 1 \\ I_2 & 4 & 1 \\ I_2 & 5 & 1 \\ I_2 & 6 & 0 \\ I_2 & 7 & 0 \\ I_2 & 8 & 0 \\ \hline I_3 & 1 & 0 \\ I_3 & 2 & 0 \\ I_3 & 3 & 0 \\ I_3 & 4 & 1 \\ I_3 & 5 & 1 \\ I_3 & 6 & 0 \\ I_3 & 7 & 1 \\ I_3 & 8 & 1 \\ \end{array} $$

Note, $D_{it}$ is not the treatment indicator in the classical DiD equation you see more often in textbooks. In the generalized setting, we regress some outcome on dummies for all $i$, dummies for all $t$, and a treatment dummy. Here, $D_{it}$ is indexing treated items $i$ and then only during the days $t$ where the treatment is actually in place. Both conditions must be present! Again, $I_2$ and $I_3$ may comprise your treatment group, but their exposure periods vary. The former item receives the shock once, while the latter receives two transient exposure periods. $D_{it}$ is your interaction term, but we code it manually to account for the irregular and intermittent treatment periods.

Issues:

(1) Common Trends - In settings where treatment is intermittent (i.e., multiple 'on/off' adoption periods), demonstrating commons trends is not so straightforward. If a sufficient time interval exists in between successive treatments, then you could plot how the outcome is trending before each exposure period. Suppose a large cohort of items resemble the exposure pattern exhibited by panel item 3 (i.e., $I_3$). You would proceed by plotting the average evolution of your outcome before day 4 (i.e., first shock) and before day 7 (i.e., second shock). But here are some considerations:

  • Do you observe items for a sufficient number of days before subsequent treatments?
  • Do you suspect any 'carry over' effects after treatment withdrawal?
  • Does early exposure affect the likelihood of receiving a later treatment?
  • Is there a synergy between treatments?

I am not posing these questions to confuse you. Rather, you should give each question some consideration before presenting your findings. In sum, you must be able to visually show the stability of your trends in the days before your treatment(s). Again, it is not so straightforward.

(2) Bias - In staggered adoption settings, the group of early-adopter units may serve as a counterfactual for the group of late-adopter units. So you're comparing the treated with the untreated at any one time period, but also each entity in the treatment group now serves as a control for all of your other treatment groups. In simple terms, your "global" DiD estimate is a weighted average of all possible two-by-two (2x2) DiD estimates that can be constructed from your panel. The weights are determined by sample sizes in each group and the variance in the treatment variable. As a consequence, the "average treatment effect" may give more weight to items treated towards the middle of your panel, which is where more entities will invariably become treated, some even multiple times. Bias is also introduced if effects change over time! As you progress over the days and more and more items become treated, you could end up with a mixture of early and late adopter entities with different growth trajectories. Please review this NBER working paper by Andrew Goodman-Bacon (2018) which explores the generalized DiD estimator in much greater detail.

Can I still use the DiD estimator? And if not, how do I need to make the adjustment to adapt for the above scenario?

Yes!

But you must proceed with the generalized DiD estimator. Read here for other digestible DiD applications.

$\endgroup$
2
  • $\begingroup$ Hi @Thomas Bilach. I was wondering if you could help me to further expand on your answer in my question here: stats.stackexchange.com/questions/606179/…. I've been going through all your posts on diff on diff, and they have been so helpful! My specific question is how can I estimate a dynamic version of the fake data frame example you provided. It seems quite difficult to define the dynamic dummy variables when treatment switches on and off. Thank you. $\endgroup$
    – TeTs
    Feb 21 at 23:16
  • $\begingroup$ Thank you for your kind words. I will definitely take a look at it. $\endgroup$ Feb 21 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.