I wonder if you can help me to figure out how to rewrite basic difference-in-difference equation (pictured) so that it takes into account the fact that treatment has occurred at different times for different observations.

This is related to, for example, Diff-in-Diff with different treatment timings for different countries & Specifying a difference in differences model with multiple time periods. I didn't find the equations there quite intuitive (also maybe because my degree is not in economics), so I thought I might ask for a simple explanation for beginners like me.

I have a panel data set of 573 universities over period 2010-2019. Some of these universities got a top rector/president (most academically successful candidate) which is treatment, some didn't get one. The treatment happened in different years: some in 2011, others in 2014 etc. I am trying to figure out how the appointment of a top rector influenced the academic score of the university.

Your help would be so much appreciated! Thank you!

enter image description here


I reproduced the canonical difference-in-differences (DiD) equation from your question below:

$$ y_{it} = \gamma Treat_{i} + \gamma Post_{t} + \delta(Treat_{i} \times Post_{t}) + \epsilon_{it}, $$

where, for example, we observe universities $i$ in years $t$. The subscript $i$ usually represents an aggregate unit (e.g., individuals, universities, counties, states, countries, etc.); some of these units receive some treatment/intervention, while others do not. The generalization of this equation, which allows for staggered treatment adoption, regresses your outcome $y$ (i.e., academic score) on a treatment indicator, and dummies for each university and each year. The following specification is a 'generalized' DiD equation which takes the following form:

$$ \text{Score}_{it} = \gamma_{i} + \lambda_{t} + \delta \text{President}_{it} + \epsilon_{it}, $$

where $\text{President}_{it}$ is equal to 1 for universities receiving the new president/rector—and only during years $t$ when the president/rector is actually serving in this position. $\gamma_{i}$ denotes university (unit) fixed effects; $\lambda_{t}$ denotes year (time) fixed effects. Your model will result in 572 separate “university” effects and 9 separate “year” effects. This may seem unwieldy, in practice, but functions exist in most software packages (e.g., R/Stata) to avoid extraneous output. Note, these fixed effects replace $Treat_{i}$ and $Post_{t}$, respectively, in the former equation. Your causal estimand of interest should be $\delta$.

The treatment variable $\text{President}_{it}$ is your interaction term $(Treat_{i} \times Post_{t})$. In the more general DiD setting, though, $Post_{t}$ is not well defined. Instead of specifying this interaction manually, we explicitly code a treatment dummy to reflect early/late adopter universities. Again, $\text{President}_{it}$ should be equal to 1 in only those university-year combinations when the treatment (i.e., president/rector assumes position) is in effect, 0 otherwise. For universities never receiving a new president/rector, it should be coded 0 for the entire observation period.

I encourage you to review this post which details the coding of the treatment dummy in greater detail.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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