Regression – Pattern of Binary Treatment Indicator in Panel Data Diff-in-Diff Analysis

difference-in-differenceeconometricspanel dataregressiontreatment-effect

I am self-studying the book Introductory Econometrics: A Modern Approach by Jeffrey M. Wooldridge and stumped upon a question while reading the chapter on Advance Panel Data Methods (Ch. 14). Normally, for a two-period diff-in-diff regression the binary treatment indicator, say $w_i$, takes the value of $0$, then $1$ for the treatment group while remains at $0$ for the control group. Now, in the chapter Wooldridge proposes the following specification for a general panel data framework with different treatment timings and $T$ periods:

$$
y_{it} = \eta_1 + \alpha_2d2_t + \dots + \alpha_TdT_t+\beta w_{it}+x_{it}\Psi + a_i + u_{it}, \ t = 1 \dots T
$$

where $w_{it}$ is the binary treatment indicator and $x_{it}$ are control variables with the usual time and entity fixed effects.

Next, he states that "$w_{it}$ can have any pattern", i.e it could be $0$ for earlier periods but $1$ for later ones. It can also be always $0$, which would be the case for entities from the control group under a diff-in-diff interpretation of the model. Now, my question is the following: can $w_{it}$ begin as $1$ and either stay the same or change to $0$? Such a pattern is quite common in panel data related to policy analysis when governments enact a policy only to retreat it a few years later. Still, my intuition tells me that allowing that would change the interpretation of the model into something other than a general diff-in-diff since such behavior would not qualify as either part of the treatment or control group. What about a binary indicator that goes back and forth between $0$ and $1$?, etc.

Thanks in advance.

Best Answer

I will assume you have a thorough grasp of the two group/two period difference-in-differences (DD) design and you now want to extend your intuition of the method to the multi-group/multi-period case. Suppose we have multiple observations of $i$ units (e.g., counties) across multiple $t$ periods (e.g., years). In DD applications, the data is ‘aggregated up’ to a higher-level, where some counties introduce a new policy/intervention and others do not. Note, the hypothetical policy/intervention serves as our “treatment” for the purposes of this example. The ‘generalized’ DD setup is as follows:

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

where $\gamma_{i}$ and $\lambda_{t}$ denote county and year fixed effects, respectively. You may also see this referenced as a ‘two-way’ fixed effects estimator. The variable $T_{it}$ is our treatment dummy, indexing the $i$ counties affected by the policy/intervention during periods $t$, 0 otherwise.

[Wooldridge] states that "$𝑤_{𝑖𝑡}$ can have any pattern", i.e it could be 0 for earlier periods but 1 for later ones. It can also be always 0, which would be the case for entities from the control group under a diff-in-diff interpretation of the model.

The ‘generalized’ approach accommodates treatment exposures in multiple groups and multiple time periods. Because of this, the treatment dummy can be coded rather flexibility to account for this. Again, $T_{it}$ is equal to 1 for treated counties and only during those $t$ years when treatment is actually in effect, 0 otherwise. Thus, for those counties never treated, it is 0 across all years that the untreated county is observed in the panel. In this setting, the variable $T_{it}$ does not demarcate a specific “treatment group” as it would in the canonical DD approach. The indicator 'turns on' (i.e., changes from 0 to 1) during precisely those ‘county-year’ combinations when the policy/intervention is in effect. As a general framework to help us exploit variation in treatment timing, this approach can be viewed as a weighted average of all possible two-group/two-period (2x2) DD estimators that can be constructed from the panel dataset. See this NBER working paper by Andrew Goodman-Bacon 2018 which explores the ‘two-way’ fixed effects estimator in greater detail.

  • I simulated a toy dataset in R and included it at the bottom of my answer. I did this to show how the treatment dummy is coded under this approach. For simplicity, it includes 3 counties observed over 10 years. The variable cty is a county identifier. Only two of the three counties are actually "treated" during this 10-year observation period. The treatment dummy 'turns on' (i.e., changes from 0 to 1) at different times in different counties. One county (i.e., County 1) serves as our control group; this county could be viewed as the "always 0" unit referenced in Wooldridge's text. Though there are many treatment-control comparisons made using this approach, you can think of the “always 0’s” as the baseline history of never receiving treatment. The treatment variable trt (see the third column from left) is the instantiation of the variable $T_{it}$ in the foregoing equation. The variable 'turns on' (equals 1) for treated counties and only when those counties enter into a post-treatment period. In this toy dataset, County 2 was exposed to treatment from the year 2013 onward. County 3, however, was a late adopter of the treatment, officially 'turning on' in 2015 before it was officially removed (i.e., 'turned off') in the last two years of the observation period. In most cases, treatment 'turns on' in county $i$ at year $t$ and remains in place. In others, counties may only have a transient exposure period, in which case we can code the dummy to reflect periods of treatment withdrawal. Note, I also included the county and year dummies. To avoid collinearity, I omitted one county dummy (i.e., c_1 = County 1) and one year dummy (i.e., y_10 = 2010).

The following plot, reproduced from these slides, shows how a panel with variation in treatment timing can be decomposed into "timing groups" reflecting observed onset of treatment.

Multiple Comparisons

Note, we can see how a late adopter entity can serve as a counterfactual for an early adopter. Similarly, when a late adopter enters into treatment (e.g., group B), a previously treated entity (e.g., group A) can also act as a counterfactual. In other words, already treated units serve as controls in some of the two-by-two DDs underlying the weighted average. The next plot highlights the different pre-post comparisons using early versus late adopters of treatment.

Multiple Pre vs. Post

It is worth noting that bias is introduced when treatment effects change over time within a unit.

Now, my question is the following: can 𝑤𝑖𝑡 begin as 1 and either stay the same or change to 0?

It can, but I wouldn’t advise you to incorporate such entities. If treated entities are always equal to 1, then they are always treated. DD approaches require you to observe some units/entities pre- and post-treatment. The always treated do not have any pre-event data. The same is true for entities that begin as 1 but then 'turn off' after some period of observation. Arguably, it is possible for you to acquire an unbalanced panel and only observe entities in the post-treatment period. I have never seen this in a DD context, though. I will let someone else contribute to this answer if there is a fix for this in practice.

Still, my intuition tells me that allowing that would change the interpretation of the model into something other than a general diff-in-diff since such behavior would not qualify as either part of the treatment or control group.

In general, I agree this would change the interpretation of your treatment effect. If you only acquired data on counties in the post-treatment period (i.e., beginning at 1), then you could assess the effects of units/entities "repealing" a policy (i.e., treatment changes from 1 to 0); this would have to occur in some counties but not others. I have seen applications where researchers conducted a DD analysis comparing all pairwise time periods. That is, they delineated pre-, during-, and after-treatment periods. The "after" period, in this case, is the period when treatment is removed. To go back to your question, if the treatment variable begins as 1 and then changes to 0 (i.e., policy/law is repealed), then this would be a comparison of the "during" period with the "after" period. This becomes problematic when treatment begins and ends at different times in different units/entities. Thus, I don't think you should include units/entities where they start in the treated condition. In my opinion, I would subject the units/entities with no pre-event data to a separate analysis.

What about a binary indicator that goes back and forth between 0 and 1?

The treatment indicator is allowed to switch ‘on’ and ‘off’ throughout the panel. This is often the case in policy analysis, where some units can have multiple treatment histories. For example, a new law was enacted in a subset of U.S. states at the beginning of 2013, only to be repealed at the conclusion of 2016. Later, legislators in a subset of U.S. states where the law was nullified decide to reintroduce the legislation again in 2018 where it remains in effect. In practice, your treatment dummy should be coded to reflect this reality. However, this could become problematic if policymakers decide to introduce or remove laws/policies based upon past outcomes of the response variable. Review pages 4 through 7 of Lecture 10 for a more in-depth discussion of this.

Research by Acemoglu and colleagues 2019 investigate the effects of democracy on economic growth. They follow 184 countries from 1960–2010. Contrary to other research in this area, they investigate permanent and transitory transitions to democracy and nondemocracy. Thus, the dichotomous treatment variable is switching ‘on’ and ‘off’ multiple times for a subset of countries. Their work was recently replicated by Imai and colleagues 2020 and a new matching estimator is now available in software (see, e.g., the PanelMatch package in R) to handle these irregular treatment patterns. For other DD applications with intermittent exposures (i.e., recurring on/off patterns), review empirical work by Fouirnaise and Mutlu-Eren 2015 in political economy, or my own research (see, e.g., Bilach et al. 2020) in criminology.

In sum, you should take good care to make sure your treatment variable is coded 1 in only those time periods when the county (or other aggregate unit) is affected by the treatment, 0 in all other time periods. There is no requirement that a treated unit stay 'turned on' for the duration of the treatment phase. And again, for counties never exposed to the new law/policy, the treatment variable would equal 0 in all time periods it is under observation (see 'County 1' below).

# Dummy coding the treatment variable in a 'generalized' DD model

 # N = 3 (counties)
 # T = 10 (years)

# Variable labels:

 # cty  = unit identifier
 # year = time identifier
 # trt  = treatment variable
 # c_   = county effects (N - 1)
 # y_   = year effects (T - 1)

# N x T = 30 county-year observations

cty year  trt c_2 c_3 y_11 y_12 y_13 y_14 y_15 y_16 y_17 y_18 y_19
1   2010    0   0   0    0    0    0    0    0    0    0    0    0
1   2011    0   0   0    1    0    0    0    0    0    0    0    0
1   2012    0   0   0    0    1    0    0    0    0    0    0    0
1   2013    0   0   0    0    0    1    0    0    0    0    0    0
1   2014    0   0   0    0    0    0    1    0    0    0    0    0
1   2015    0   0   0    0    0    0    0    1    0    0    0    0
1   2016    0   0   0    0    0    0    0    0    1    0    0    0
1   2017    0   0   0    0    0    0    0    0    0    1    0    0 
1   2018    0   0   0    0    0    0    0    0    0    0    1    0
1   2019    0   0   0    0    0    0    0    0    0    0    0    1

2   2010    0   1   0    0    0    0    0    0    0    0    0    0
2   2011    0   1   0    1    0    0    0    0    0    0    0    0
2   2012    0   1   0    0    1    0    0    0    0    0    0    0
2   2013    1   1   0    0    0    1    0    0    0    0    0    0
2   2014    1   1   0    0    0    0    1    0    0    0    0    0
2   2015    1   1   0    0    0    0    0    1    0    0    0    0
2   2016    1   1   0    0    0    0    0    0    1    0    0    0
2   2017    1   1   0    0    0    0    0    0    0    1    0    0
2   2018    1   1   0    0    0    0    0    0    0    0    1    0
2   2019    1   1   0    0    0    0    0    0    0    0    0    1

3   2010    0   0   1    0    0    0    0    0    0    0    0    0
3   2011    0   0   1    1    0    0    0    0    0    0    0    0
3   2012    0   0   1    0    1    0    0    0    0    0    0    0
3   2013    0   0   1    0    0    1    0    0    0    0    0    0
3   2014    0   0   1    0    0    0    1    0    0    0    0    0
3   2015    1   0   1    0    0    0    0    1    0    0    0    0
3   2016    1   0   1    0    0    0    0    0    1    0    0    0
3   2017    1   0   1    0    0    0    0    0    0    1    0    0
3   2018    0   0   1    0    0    0    0    0    0    0    1    0
3   2019    0   0   1    0    0    0    0    0    0    0    0    1

I hope this helps!

Related Question