When I estimate a difference in differences model with two time periods, the equivalent regression model would be

a. $Y_{ist} = \alpha +\gamma_s*Treatment + \lambda d_t + \delta*(Treatment*d_t)+ \epsilon_{ist}$

  • where $Treatment$ is a dummy which is equal to 1 if the observation is from the treatment group
  • and $d$ is a dummy which is equal to 1 in the time period after the treatment occured

Thus the equation takes the following values.

  • Control group, before treatment: $\alpha$
  • Control group, after treatment: $\alpha +\lambda$
  • Treatment group, before treatment: $\alpha +\gamma$
  • Treatment group, after treatment: $\alpha+ \gamma+ \lambda+ \delta$

Hence, in a two period model the difference in differences estimate is $\delta$.

But what happens concerning $d_t$ if I have more than one pre and post treatment period? Do I still use a dummy that indicates whether a year is before or after the treatment?

Or do I add year dummies instead without specifying whether each year belong to the pre or post treatment period? Like this:

b. $Y_{ist} = \alpha +\gamma_s*Treatment + yeardummy + \delta*(Treatment*d_t)+ \epsilon_{ist}$

Or can I include both (i.e $yeardummy +\lambda d_t$)?

c. $Y_{ist} = \alpha +\gamma_s*Treatment + yeardummy + \lambda d_t + \delta*(Treatment*d_t)+ \epsilon_{ist}$

In conclusion, how do I specify a difference in differences model with multiple time periods (a,b or c)?

  • 1
    $\begingroup$ You generally use model b. Notice that in model c, $d_t$ will be perfectly collinear with the year dummies, so that model can't be estimated. $\endgroup$ Commented Jan 17, 2014 at 12:28
  • $\begingroup$ It would be great if you could explain why b is used generally. Maybe give some references, or just give a 2 sentence explanation. $\endgroup$
    – mpiktas
    Commented Jan 17, 2014 at 12:51
  • $\begingroup$ and in model b. could you add a continuous variable for year instead of dummies? How would the interpretation of the coefficients differ in those cases? $\endgroup$
    – user71597
    Commented Mar 20, 2015 at 16:22
  • $\begingroup$ You can use a continuous variable for year if it makes sense to assume a linear trend for the outcome in the control group, that is also the conterfactual outcome in absence of the treatment for all groups. $\endgroup$ Commented Mar 13, 2022 at 21:21

2 Answers 2


The typical way to estimate a difference in differences model with more than two time periods is your proposed solution b). Keeping your notation you would regress $$Y_{ist} = \alpha +\gamma_s (\text{Treatment}_s) + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$ where $D_t \equiv \text{Treatment}_s\cdot d_t$ is a dummy variable which equals one for treatment units $s$ in the post-treatment period ($d_t = 1$) and is zero otherwise. Note that this is a more general formulation of the difference in differences regression which allows for different timings of the treatment for different treated units.

As was pointed out correctly in the comments your proposed solution c) does not work out due to collinearity with the time dummies and the dummy for the post-treatment period. However, a slight variant of this turns out to be a robustness check. Let $\gamma_{s0}$ and $\gamma_{s1}$ be two sets of dummy variables for each control unit $s0$ and each treated unit $s1$, respectively, then interacting the dummies for the treated units with the time variable $t$ and regressing $$Y_{ist} = \gamma_{s0} + \gamma_{s1}t + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$ includes a unit specific time trend $\gamma_{s1}t$. When you include these unit specific time trends and the difference in differences coefficient $\delta$ does not change significantly you can be more confident about your results. Otherwise you might wonder whether your treatment effect has absorbed differences between treated units due to an underlying time trend (can happen when policies kick in at different points in time).

An example cited in Angrist and Pischke (2009) Mostly Harmless Econometrics is a labor market policy study by Besley and Burgess (2004). In their paper it happens that the inclusion of state-specific time trends kills the estimated treatment effect. Note though that for this robustness check you need more than 3 time periods.

  • $\begingroup$ A follow up since I am trying to decide if implementing this with some administrative data is appropriate: Would you say a DD approach is more valid than a CITS design if there are only 4 time points (2 pre and 2 post) in a model? Also, if I have multiple cohorts within waves of data should these be examine separately or in a unified model? Thanks. $\endgroup$
    – bfoste01
    Commented Feb 24, 2016 at 17:02
  • $\begingroup$ @Andy: Can you pls explain, what you mean by s0, s1, and unit-specific time trend? Assuming I have two newspapers (WPT and NYT) and WPT is my treatement group, which of them would be s0 and s1? $\endgroup$ Commented Apr 12, 2018 at 20:49
  • 1
    $\begingroup$ Am I right in thinking that this analysis compares the average pre and post treatment and does not account for secular trends? i.e. if d_t = 0 for all time periods before the switch point, and d_t = 1 for all time periods after, then this analysis is essentially the same as the two time periods one, except the average is taken of all the before/after time periods. Any time trends in the outcome before/after the treatment switch are ignored? I am trying to decide if a DiD model is correct for an analysis I am planning to carry out. $\endgroup$
    – AP30
    Commented Mar 11, 2019 at 17:42
  • $\begingroup$ The year dummy t allows you to take into account differnces between timepoints even if they are both before or both after the time treatment starts. I'd say what you assume to be constant across time is treatment effect. $\endgroup$ Commented Mar 13, 2022 at 21:05
  • 1
    $\begingroup$ How can the model $$Y_{ist} = \gamma_{s0} + \gamma_{s1}t + \lambda (\text{year dummy}_t) + \delta D_{st} + \epsilon_{ist}$$ be correct with this interpretation? For the treated at time 0 we would have $Y=\epsilon_{ist}$. $\gamma_{s0}$ and $\gamma_{s1}$ must be parameters related to all observations (representing intercept and slope, respectively), not to the two treatment groups separately. $\endgroup$ Commented Mar 13, 2022 at 21:26

I would like to clarify something (and indirectly address a question in the comments). In particular, it concerns the use of unit-specific linear time trends. As a robustness check, it would appear you are only interacting dummies for treated units (i.e., $\gamma_{1s}$) with a continuous time trend. However, it is actually the case that you are interacting a full set of unit/state dummies (unit/state fixed effects) with a linear time trend variable.

Angrist and Pischke (2009) recommend this approach on page 238 in Mostly Harmless Econometrics. Differences in notation can cause confusion. Reproducing specification 5.2.7:

$$ y_{ist} = \gamma_{0s} + \gamma_{1s} t + \lambda_{t} + \delta D_{st} + X^{'}_{ist}\beta + \varepsilon_{ist}, $$

where $\gamma_{0s}$ is a state-specific intercept, in accordance with the $s$ subscript used in their book. You can view $\gamma_{1s}$ as the state-specific trend coefficient multiplying the time trend variable, $t$. Different papers use different notation. For example, Wolfers (2006) replicates a model incorporating state-specific linear time trends. Reproducing model (1):

$$ y_{s,t} = \sum_{s} State_{s} + \sum_{t} Year_{t} + \sum_{s} State_{s}*Time_{t} + \delta D_{s,t} + \varepsilon_{s,t}, $$

where the model includes state and year fixed effects (i.e., dummies for each state and year). The treatment variable $D_{s,t}$ is when state $s$ adopts a unilateral divorce regime in period $t$. Notice this specification interacts state dummies with a linear time trend (i.e., $Time_{t}$). This is yet another representation of state-specific linear time trends in your model specification.

Unit-specific linear time trends is also addressed nicely in the comments section here.

In sum, you want to interact all unit (group) dummies with a continuous time trend variable.

You can read the paper by Justin Wolfers (2006) for free here.


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