# Event study / DiD with panel data and repeated treatment in different years for each country

I have an unbalanced panel dataset with approximately 30 countries from 1980-2000. I would like to study how political uncertainty measured by close elections affects a certain continuous variable $$Y$$, say countries' investments. The independent variable is thus close elections where 1 indicates a very even election outcome and 0 indicates either a non-close election year or a non-election year. So, the treatment variable is a close election which may have occurred several times within a country during the period 1980-2000. Now I want to do an event study with two-way fixed effects including one lag and one lead variable to study the effect before and after the treatment. The specification I have in my mind would then look like the following:

$$Y_{ct} = beta_0 + \beta_1 \times Treat_{ct} + \beta_2 \times Lag1_{ct} + \beta_3 \times Lead1_{ct} + \beta_4 \times Treat_{ct} \times Lag1_{ct} + \beta_5 \times Treat_{ct} \times Lead1_{ct} + Country_{FE} + Year_{FE} + u_{ct}$$

where $$Treat$$ is close election.

My questions are:

(1) Whether this counts as a diff-in-diff or event study if the treatment occurs repeatedly and in different periods for each country?

(2) If this is a form of diff-in-diff, can one argue that the parallel assumption is valid by stating that the countries that are not treated at same time serve as the control group and that the fixed effects ensure that the groups aren't behaving differently?

(3) If not, what would be the right model to use in order to estimate this effect?

Country Year TREAT Lag 1 Lead 1
1 1980 0 1 0
1 1981 1 0 0
1 1982 0 0 1
1 1983 0 0 0
1 1984 0 0 0
1 1985 0 0 0
1 1986 0 0 0
1 1987 0 1 0
1 1989 1 0 0
1 1990 0 0 1
1 ... ... ... ...
30 1980 0 0 0
30 1981 0 0 0
30 1982 0 1 0
30 1983 1 0 0
30 1984 0 0 1
30 1985 0 1 0
30 1986 1 0 0
30 1987 0 0 1
30 1989 0 1 0
30 1990 1 0 0
30 ... ... ... ...
• So a close (even) election is the "treatment" in your setting. By design, the treatment is only in effect for one period at a time, correct? Commented Nov 26, 2021 at 18:33
• @ThomasBilach Yes, exactly. Commented Nov 29, 2021 at 9:31

Whether this counts as a diff-in-diff or event study if the treatment occurs repeatedly and in different periods for each country?

The difference-in-differences (DiD) equation you're considering has been adapted to assess how investments vary with time since exposure to treatment. In most DiD applications, the equation is modified to satisfy the conditions of a typical "event study" framework, though I'm not so comfortable arguing that all "event study" applications qualify as DiD methodologies. In my opinion, the term "event study" is a rather broad methodological framework for the study of "events" in general, and it has traditionally been used to study a market's reaction to financial events/shocks. Peruse the accepted answer here for more detail.

As for your other concern, the treatment variable in this more general setting can take on almost any pattern, including one where the event starts at different times in different countries, and/or where countries experience multiple events over time. In fact, the generalized DiD equation is commonly used in settings with nonuniform exposure patterns. Upon review of the abridged data frame included in your post, it appears you've coded the relevant period indicators appropriately. Even though the treatment 'turns on' and 'turns off' multiple times over time, it still retains the basic structure of a DiD equation. The leads and lags of treatment assess the evolution of investments around close election years.

If this is a form of diff-in-diff, can one argue that the parallel assumption is valid by stating that the countries that are not treated the same time serve as the control group and that the fixed effects ensure that the groups aren't behaving differently?

The "fixed effects" do not ensure a parallel trajectory of the trends over time. That is for you to demonstrate to your audience. By including the lag in your specification, you've already given this some thought. The "effect" of a close election on say, direct investments, shouldn't emerge before the actual referendum. But is one lag enough? Perhaps not, especially if you suspect investments vary in anticipation of the actual election.

Investigating more than one lead and/or lag is also complicated by the fact that political uncertainty sunrises and sunsets with a more or less predictable cadence every few years. Do you suspect political uncertainty will 'carry over' into the next election cycle? Because it appears a subset of countries have many sequential treatments in close temporal sequence, I would only include a finite number of leads and/or lags. Note how "event time" doesn't always correspond with actual calendar time. Estimating a long-run effect by including a second and third lead may seem appropriate, but by the third lead a country may already be moving into a second wave of treatment, as is the case with 'Country 30' in your data frame.

On a tangential note, 'Country 30' is a unique case. The events suggest triennial election cycles, but the third election in 1990 suggests otherwise. If you're considering a mixture of local and regional elections, then it's prudent to match treated countries with counterfactuals that have a similar treatment history up until the next election. There are computationally efficient ways of doing this, and I believe my answer here should help. That answer also recommends a couple of useful R packages.

Lastly, I want to address some concerns with respect to notation.

Note, the interactions between $$Treat_{ct}$$ and the lead/lag variables are redundant. The interaction term is implicit in the coding of the treatment variable. To be specific, $$Treat_{ct}$$ equals 1 if country $$c$$ is treated in year $$t$$, 0 otherwise. Simply include the relevant periods indicators as is. I reproduced your model below:

$$Y_{ct} = \beta_0 + \beta_1Lag^{1}_{ct} + \beta_2Treat_{ct} + \beta_3Lead^{1}_{ct} + Country_{FE} + Year_{FE} + u_{ct}$$

where $$Lag^{1}_{ct}$$ and $$Lead^{1}_{ct}$$ assess effects in the periods before and after a close election year, respectively. I often see the terms reversed, where the lag denotes the delayed onset of treatment. As long as you keep the notation consistent and explain what the relevant variables mean, it shouldn't really matter.

Technically, the lead/lag variable is a clone of the treatment variable. The only difference is they represent different time configurations of $$Treat_{ct}$$. To make the equation more compact, let's define $$T_{ct}$$ as the immediate effect of treatment. Political uncertainty is transient, by definition, so $$T_{ct}$$ is the same as the treatment variable from earlier. Here is a different way to specify your equation:

$$Y_{ct} = \gamma_c + \lambda_t + \beta_{-1} T_{c,t-1} + \beta T_{ct} + \beta_{+1} T_{c,t+1} + u_{ct}$$

where $$\gamma_c$$ and $$\lambda_t$$ represent fixed effects for countries and years, respectively. The variable $$T_{c,t-1}$$ is testing for a specific consequence of treatment in the period before the actual election year. Assuming consequences do not precede causes, you shouldn't be observing a strong non-zero effect pre-event. On the other hand, $$T_{c,t+1}$$ investigates whether the effect of a close election on investments lingers beyond that election year, or kicks in with some delay. Your post-treatment epoch is limited to one year, so you should expect countries' investments to mostly concentrate around a "close" election—not just any election. I recommend plotting the $$\hat{\beta}$$'s to get a sense of how investments evolve around uncertain elections.