Diff in diff model with multiple treatments in multiple perdiods?

Can I estimate a diff in diff model to compare the effects of two different treatments that apply in different time periods in different countries?

I have 30 countries for an average time span of 34 years. All of these countries are subject to these two different shocks (treatments) that happen several times during the time span.

An example could be the following:

1) Treatment one: Austria 1972, 1989, 1990 Belgium 2000, 2002 Canada 1972, 1999, 2008, 2009, 2010

2) Treatment two: Austria 1990, 1992, 2014 Belgium 2005, 2014 Canada 1990, 1999, 2001, 2015

I have no un-treated countries.

Is it possible to estimate a diff in diff? Do you have alternative suggestions?

For simplicity, suppose there are 3 countries, and you can extend the model into more countries.

Let $$Y$$ be your continuous response variable. $$X_1 = 1$$ for treatment 2 and =0 for treatment 1. $$X_2 = 1$$ for country 2, = 0 for country 1 and 3, $$X_3 = 1$$ for country 3 and =0 for contry 1 and 2. $$X_4 =$$year - 1972 (suppose 1972 is earliest year in dataset). Suppose the model is: $$Y=\beta_0 + \beta_1X_1 +\beta_2X_2+\beta_3X_3+\beta_4X_4 + \beta_5X_1X_2+\beta_6X_1X_3 +\epsilon$$

Suppose you want to test/estimate the difference between tow treatment on the difference between country 2 and country 3 at the given year $$X_4=x_4$$, i.e., $$[E(Y|X_1=0, X_2=1, X_3=0,X_4=x_4) - E(Y|X_1=0, X_2=0, X_3=1,X_4=x_4)] - [E(Y|X_1=1, X_2=1, X_3=0,X_4=x_4) - E(Y|X_1=1, X_2=0, X_3=1,X_4=x_4)]$$ .

$$E(Y|X_1=0, X_2=1, X_3=0,X_4=x_4) = \beta_0 +\beta_2 +\beta_4x_4$$

$$E(Y|X_1=0, X_2=0, X_3=1,X_4=x_4) = \beta_0 +\beta_3 +\beta_4x_4$$

$$E(Y|X_1=1, X_2=1, X_3=0,X_4=x_4) = \beta_0 +\beta_1 +\beta_2 +\beta_4x_4 +\beta_5$$

$$E(Y|X_1=1, X_2=0, X_3=1,X_4=x_4) = \beta_0 +\beta_1 +\beta_3 +\beta_4x_4 + \beta_6$$

Plugging them in to the diff in diff,

$$E(Y|X_1=0, X_2=1, X_3=0,X_4=x_4) - E(Y|X_1=0, X_2=0, X_3=1,X_4=x_4)] - [E(Y|X_1=1, X_2=1, X_3=0,X_4=x_4) - E(Y|X_1=1, X_2=0, X_3=1,X_4=x_4)] =[\beta_2 - \beta_3] - [\beta_2-\beta_3+\beta_5-\beta_6]= \beta_6-\beta_5$$

So $$\beta_6- \beta_5$$ is the diff in diff, and you can estimate and/or test it after your model fitting.

• Thank you very much for your useful answer. Can this works for multiple years? In addiction these two treatments are totally different from each other and there is no reason to suppose that in a given year we must have both, we actually have that sometimes you have only one of them Nov 9 '18 at 21:27
• Yes, it works for multiple years, $X_4$ = year - 1972. Do not need to have two treatments at the same year. In summary, for each measurement of response variable, the country, treatment, and year are needed, no more other restriction. Nov 9 '18 at 21:36
• great. And what if the two effects are contemporaneous? Nov 10 '18 at 8:32
• which two effects? country and treatment? $E(Y|X_1=1, X_2=1, X_3=0,X_4=x_4) = \beta_0 +\beta_1 +\beta_2 +\beta_4x_4 +\beta_5$, this is for treatment 2 in country 2. Nov 10 '18 at 15:52
• Clear. I mean that treatment 1 and treatment 2 can be present in the same country in the same year. What to do in that case? Nov 10 '18 at 20:23