# Event study regression specification: interacting covariates with leads and lags

I want to create an event study regression specification for the following:

$$\ln(y_{ijt}) = \gamma \ln (x_{jt}) + \tau \ln(p_{t}) + \lambda \ln(x_{jt}) * \ln(\mbox{p}_{t}) + \epsilon_{ijt}.$$

I am not sure if the following would be the correct event study specification:

$$\ln(y_{ijt}) = \sum_{k=-a}^a\gamma_k \ln (x_{j,t-k}) + \sum_{k=-a}^a \tau_k \ln(p_{t-k}) + \sum_{k=-a}^a \lambda_k \ln(x_{j,t-k}) * \ln(\mbox{p}_{t-k}) + \epsilon_{ijt}$$

I am interested in the coefficients $$\gamma_k$$ and $$\lambda_k$$, and not on $$\tau_k$$. Should I lead and lag the covariate?

Can someone share some thoughts on if the above event-study specification is correct?

• Welcome. I’m not sure why you included three separate summations. Why are the $\lambda_k$’s estimated with interactions and not the $\gamma_k$’s? Commented Apr 23 at 3:30
• @ThomasBilach, thanks for responding. I am just curious how one has the event study specification when there is an interaction term. Example, suppose I am interested at effects of a variable $x$ on a variable $y$ and also want to understand how another variable $p$ modulates this effect. This is my first equation. I now want to recover leads/lags, so want to do an event-study version of the first equation. Not sure how I should get to this. Does this make it clear? Thanks. Commented Apr 23 at 5:29
• I makes more sense. Does $p$ vary over time, but the same for all $j$ units? Is $p$ the indicator for the "event" of interest? Commented Apr 25 at 16:44
• @ThomasBilach Yes, $p$ varies over time but is same for all $j$ units. It is not an indicator for the event. It is a variable which modulates the effect of $x$ on $y$. I want to see how this effect evolves over time, so I want to run a event-study. Does this clarify? Commented Apr 26 at 18:10
• It makes sense. However, I cannot advise you further without more information. Is $x_{jt}$ a binary "event" variable? Do all $j$ units experience the event? And if so, do all $j$ units experience the event in the same time period $t$? Commented Apr 29 at 2:23

As indicated in the comments, $$p_t$$ is time-varying but exhibits the same pattern across the $$j$$ units. If you're estimating the standard difference-in-differences equation, adjusting for time effects, then $$p_t$$ is collinear with those aggregate level temporal shocks. In short, you can safety drop it. The main effect of $$p_t$$ isn't meaningful anyway. Moreover, it is not necessary to adjust the time configuration of $$p_t$$ either. Simply multiply $$p_t$$ with the the leads and lags of $$x_{jt}$$ directly.

Assume a binary treatment variable $$x_{jt}$$, such as a county level tax policy or whatever is of interest to you. Now say the policy is rolled out at different times in different counties. Here, $$x_{jt}$$ is just an indicator for whether the treatment 'switched on' (i.e., changed from 0 to 1) in county $$j$$ and year $$t$$. The equation below seems appropriate,

$$\ln(y_{ijt}) = \alpha_j + \lambda_t + \sum_{k=-m}^{q}\gamma_k x_{j,t+k} + \sum_{k=-m}^q \tau_k x_{j,t+k} \times \ln(\mbox{p}_{t}) + \epsilon_{ijt},$$

where we estimate some arbitrary number of $$q$$ leads and $$m$$ lags of the policy variable. I altered the limits of the summation, but feel free to keep the $$a$$ and $$-a$$ convention if that works for you. $$\gamma_k$$ denotes a series of lead and lag parameters. To assess the moderating influence of $$p_t$$ on the relationship between $$x$$ and $$y$$, simply interact $$p_t$$ with each of the policy indicators. The $$\tau_k$$ parameters will offer some insight into how this effect is evolving before and after the policy change.

I simulated some data in R to demonstrate what this looks like in the real world. The full data frame consists of 5 counties observed over 10 years. Each county has a different "start year" as indicated by the first_treat variable. The event_time column is just the difference between first_year and year. Each treated county is now centered around their first (immediate) policy year (event_time = 0). The abridged data frame below shows two treated counties over a 10-year period. If you estimate separate dummy variables for each value of event_time it will automatically generate the leads and lags for you. Note that in a setting where a subset of counties never adopt the new policy, they remain equal to 0 in all periods. For the sake of this explanation, say all counties adopts the policy, but they vary in the timing of the first adoption.

## Variables:

# county      = county identifier
# year        = year identifier
# t_group     = treatment indicator
# post        = post-treatment indicator
# first_treat = first year treatment starts
# event_time  = first_treat - year
# cov_t       = covariate (time-varying but stable across counties)
# y           = continuous outcome

# A tibble: 50 × 8
county  year t_group  post first_treat event_time cov_t     y
<fct>  <int>   <dbl> <dbl>       <dbl> <fct>      <dbl> <dbl>
1 1       2010       1     0        2013 3             14  83.0
2 1       2011       1     0        2013 2             14  86.1
3 1       2012       1     0        2013 1             12  78.8
4 1       2013       1     1        2013 0             11  79.8
5 1       2014       1     1        2013 -1            11  75.1
6 1       2015       1     1        2013 -2            19  87.0
7 1       2016       1     1        2013 -3            17  86.2
8 1       2017       1     1        2013 -4            15  82.5
9 1       2018       1     1        2013 -5            18  80.6
10 1       2019       1     1        2013 -6            15  72.7
11 2       2010       1     0        2014 4             14  89.9
12 2       2011       1     0        2014 3             14  71.4
13 2       2012       1     0        2014 2             12  83.2
14 2       2013       1     0        2014 1             11  86.1
15 2       2014       1     1        2014 0             11  83.9
16 2       2015       1     1        2014 -1            19  79.4
17 2       2016       1     1        2014 -2            17  72.1
18 2       2017       1     1        2014 -3            15  86.2
19 2       2018       1     1        2014 -4            18  80.5
20 2       2019       1     1        2014 -5            15  81.0


If cov_t has the same pattern within each county, as $$p_t$$ suggests, then it's collinear with the year fixed effects. In other words, once we adjust for the aggregate level time shocks affecting all counties in the same way, then inputting cov_t into the model, or any lead or lag of it, offers no advantage. Even if you estimated cov_t first in terms of variable precedence, most software packages compromise by dropping a year.

In short, do not lead or lag $$p_t$$. In the presence of the county and year fixed effects, the main effect associated with $$p_t$$ isn't even estimable, nor relevant for the question your pursuing. Simply interact the leads and lags of the policy variable $$x_{jt}$$with $$p_t$$ directly. The evolution of the $$\tau_k$$'s is what matters.

I recommended some R code below. The base R solution will work just fine, although the output is a little messy. In my opinion, the fixest package offers a cleaner output, and their ref = ... option allows you to manually select the reference year.

# base R

lm(log(y) ~ as.factor(county) + as.factor(year) + factor(event_time) * log(cov_t), data = ...)

# library(fixest)

feols(log(y) ~ event_time + i(event_time, log(cov_t), ref = 1) | county + year, panel.id = ~county + year, data = ...)

• Wow, this is perfect.I couldn't upvote due to no reputation points, but I just accepted the answer. Thanks a lot for your insights. Commented May 8 at 17:24