# Difference in Difference with leads and lags

Following this previous thread, I am somewhat confused about using a difference-in-difference estimator with leads and lags. What does the esimation equation look like exactly? I have found several equations, but it was not clear to me what they exactly mean. For example, here on page 9 Pischke writes down this equation:

$Y_{ist} = \gamma_s + \lambda_t + \sum_{j=-m}^{q} \beta_j D_{st+j} + e_{ist}$

Here $Y_{ist}$ is the outcome variable (for example) for individual $i$ in state $s$ in time $t$. State fixed effects are $\gamma_s$, while $\lambda_t$ are time dummies for each period.

I am familiar with the sum notation, but I do not fully understand how the difference-in-difference estimator $D_{st+j}$ is defined here. When exactly is $D_{st+j}$ $1$ or $0$? How do we interpret these regressors? Could someone please also provide an example? Furthermore, why does the equation above not suffer from a dummy variables trap?

The short answer is that $D_{st+j}$ is the product of the time and treatment dummy indicators. These test the difference-in-differences effects. However, how you create the indicator variables affects the interpretation.

Let's start with the simple case of two groups (treatment and control) and two time periods (before and after). If we create the indicator variables as 0/1 dummy codes with treatment=1/control=0 and before=0/after=1 then the product of these would have treatment+after=1/all others=0. Assuming a balanced design (equal sample sizes in all conditions) and no other variables in the model, a basic regression model would produce the following: (1) intercept that equals the mean for the control group at time 0 (before); (2) treatment coefficient that equals the treatment-control difference at time 0 (before); (3) time coefficient that equals the time effect for the control group; and (4) the interaction coefficient between treatment and time that is the difference-in-differences or difference in the change over time for the treatment versus control conditions. Only the latter coefficient is of any real interpretive value in this model. Using effect coding produces meaningful coefficients for the intercept, treatment, and time coefficients, with the intercept reflecting the grand mean, the treatment coefficient reflecting 1/2 of the marginal treatment effect and the time coefficient reflecting 1/2 of the marginal time effect (you could also use .5/-.5). [Note that effect-coding with 3 or more conditions is 1/0/-1 with the -1 used for the referent category).

The model you present above extends this out to more time periods. If time 1 (before) is the referent category, then the typical 0/1 dummy indicators reflect the difference-in-differences effect for time 0 relative to time t. With different indicator-coding, you can test different hypotheses (e.g., time 0 versus times 1+2+3).

• Thank you. Could you provide an example regression equation for multiple periods where $D_t+j$ is spelled out, e.g. for 2 leads and lags? Do I interact treatment with a time dummy for a single period (e.g. $j$) or multiple dummies indicating all periods after a certain period (e.g. $j$). So suppose $T$ is a dummy for treated states and $I_j$ is a dummy equal 1 if we are in period $j$. and treatment occurs in 2010. Do I estimate $Y_{ist}= \gamma_s + \lambda_t + \beta_1 I_{2008}*T_s + \beta_2 I_{2009}*T_s + \beta_3 I_{2010}*T_s + \beta_4 I_{2011}*T_s$? If so, how would you interpret the betas?
– Bob
May 3, 2018 at 12:54
• The accepted answer to this post has a good explanation. Basically, the second lead becomes the referent condition for the dummy coding. In this way, the interaction for the first time*treatment coefficient tests whether the trends are parallel between time 1 and time 2. The remaining interaction coefficients test the treatment effect at each follow-up adjusting for the last pre-treatment observation. May 3, 2018 at 14:02
• (+1). Thank you. If I understand that post correctly, then the answer explains how to test the common trends assumption using distinct time trends for treatment and control. I believe, however, that leads and lags are a distinct way to test the common trends assumption (according to Angrist and Pischke (2009) Mostly Harmless Econometrics). Unfortunately, I do not fully understand how to translate the estimation equation for that type of test (group specific trends) to the case of leads and lags. Sorry for being so difficult.
– Bob
May 3, 2018 at 15:06
• I've not done models as complex as the link, so my comment may be wrong. However, with a single treatment and single control group, 2 lags and 3 leads, I think the model would be implemented as: control dummy (1=control/0=not control); treatment by linear time (treatment dummy times time coded as 1, 2, 3, 4, 5); time 1 dummy; time 3 dummy; time 4 dummy; time 5 dummy; treatment * time 1; treatment * time 3; treatment * time 4; treatment * time 5; and no intercept. If the treatment*time coefficient is significant, then the common trends is violated. May 3, 2018 at 18:52