<p>Say you have a population of farmers that are very similar, to the point that we can think of them as largely homogeneous. In year 0 we record the agricultural productivity of 6% of the farmers. In year 1 we give pest resistant seeds to 1% (1/6th of the sample) for one year only and again record everyone's productivity. In year 2, we do the same thing with a different 1% getting free the pest resistant seeds . In year 3, we do it yet again with a third group of 1%. Further imagine that in the pests only attack in year 2.</p>
<p>In this world, agricultural productivity is going to be the same across the two groups in years 0, 1, and 3. Assuming no selection or other complex responses, only in year two will the productivity of the groups differ.</p>
<p>As I understand it, in a homogeneous Difference in Difference problem, we assume that the treatment effect (here getting the special seeds, which just as easily and legitimately could have been an intent to treat effect) is constant across time and groups (otherwise we are just investigating an average treatment effect), N.B. this problem doesn't have different groups. So if the productivity benefit on the treated group in year 2 was +30% to productivity, using all the years, and comparing them to the pre-treatment values, you'd get an average Difference in Difference treatment effect of about 10%. But, if we allowed for a heterogeneous treatment effect by year, we would see that the treatment effects would be +0%, +30%, and +0%.</p>
<p>Now, in this particular setting we may have enough periods, controls, and fixed effects that we can take care of this. Say, we could do a triple interaction with the presence of pests with the treatment year and the treatment population in that year. However, in more complex non-experimental settings, that won't generally be possible. We need a way to allow the effect of the treatment (or intent to treat) on the treated to vary across time and or groups. And that requires a model of  &quot;Difference-in-Difference” models with heterogeneous effects.&quot;</p>
<p>In a classic difference in difference model with one level of treatment and two time periods (pre- and post-treatment), we have a setup like this:</p>
<p><span class="math-container">$$ y_{i,t} = \beta_0 + \beta_1 \cdot 1_{treat, i} + \beta_2 \cdot 1_{post, t} + \beta_3 \cdot 1_{treat, i} \cdot 1_{post, t} + \epsilon_{i,t}$$</span></p>
<p>The difference in difference estimator is <span class="math-container">$\beta_3$</span>, the change in the difference in the two groups over time. In the pest problem, <span class="math-container">$\beta_3$</span> would be about 10%.</p>
<p>In our pest problem, if we wanted to do this as a triple interaction instead:</p>
<p><span class="math-container">$$ y_{i,t} = \gamma_0 + \gamma_1 \cdot 1_{treat, i} + \gamma_2 \cdot 1_{post, t} + \gamma_3 \cdot 1_{pest, t} + \gamma_4 \cdot 1_{treat, i} \cdot 1_{post, t} + \gamma_5 \cdot 1_{treat, i} \cdot 1_{pest, t} + \gamma_6 \cdot 1_{post, i} \cdot 1_{pest, t} + \gamma_7 \cdot 1_{treat, i}  \cdot 1_{post, i} \cdot 1_{pest, t} + \zeta_{i,t}$$</span>
When we estimate this equation, <span class="math-container">$\gamma_4=0$</span>, but <span class="math-container">$\gamma_7=0.3$</span>.</p>
<p>The alternative, and probably more common setup, is to do it like this (as I understand it, this is a version of what the linked author does):</p>
<p><span class="math-container">$$ y_{i,t} = \alpha_0 + \alpha_1 \cdot 1_{treat, i} + \alpha_2 \cdot 1_{i-ever-treated} + \sum_{k=1}^T \alpha_{2+k} \cdot 1_{i-treated-in-year-k} \cdot 1_{t=k} + \xi_{i,t}$$</span></p>
<p>This gets you time varying DiD treatment effects by looking at the values of <span class="math-container">$\alpha_{2+k}$</span>. This is more common because we don't always have a hypothesis of how the DiD effects will vary over time, and so we don't know what moderating variable to use in the interaction in the second equation. Or sometimes we expect a treatment effect to build or shrink over time, but we want to know the speed and strength of that change for its own sake.</p>

CC BY-SA 4.0
2021-06-06T23:51:34.033Z
Thank you for your answer , may I ask "**In this world, agricultural productivity is going to the same across the two groups in years 0, 1, and 3. Assuming no selection or other complex responses, only in year two will the productivity of the groups differ.**" do you mean it is the assumption for the real result?. And whether in your example, each year you only applie the pest resistant seeds for 1/6 of the whole sample, not accumulated (I mean, in year 3, only 1/6 being treated rather than 1/2)?
Phil Nguyen
CC BY-SA 4.0
2021-06-06T23:57:30.160Z
(2) I still not yet got the idea of "**Say, we could do a triple interaction with the presence of pests with the treatment year and the treatment population in that year **" Could you please clarify more about this idea?
Phil Nguyen
CC BY-SA 4.0
2021-06-07T01:33:08.200Z
In my example, to keep it as clear as possible and to not worry about complicating the interpretation of the coefficient in the Difference in Difference, I was assuming the special seeds were only used in one year.  By assuming no selection or other responses, I was trying to rule out things like more productive farms choosing to use the special seeds even though they didn't realize any benefits in the year of treatment. I'm trying to focus on treatment in the year of treatment only and show the average effect.  I will try to edit the problem soon to show a triple interaction example.
BKay
CC BY-SA 4.0
2021-06-07T04:02:26.393Z
Thank you so much, when you finish editing, could you please comment here that I can come back to the post and learn from your example? Thank you.
Phil Nguyen
CC BY-SA 4.0
2021-06-08T13:33:56.083Z
@Knowledge-chaser , let me know if that clarifies
BKay
CC BY-SA 4.0
2021-06-09T21:34:15.733Z
could you please check the **Math Processing Error** in your post, please? I misunderstood why there are two "=" signs
Phil Nguyen
CC BY-SA 4.0
2021-06-09T21:36:26.687Z
Ad from this [post](https://economics.stackexchange.com/questions/45329/what-are-the-meanings-of-difference-in-differences-and-causal-estimand), it seesm that $\beta_3$ is causal estimand, not difference-in-difference estimator? I am wondering
Phil Nguyen
CC BY-SA 4.0
2021-06-09T21:43:04.947Z
It is all okay until the second-to-last equation, I am wondering where $\gamma_1$ to $\gamma_7$ coming from, thank you
Phil Nguyen
CC BY-SA 4.0
2021-06-10T02:40:52.863Z
I fixed the $\gamma_7$ typo.  $\beta_3$  is the average difference between pre- and post- for the treated and control populations, so it is the diff in diff.
BKay
CC BY-SA 4.0
2021-06-10T03:01:48.863Z
I understand the story now, thank you so much, BKay
Phil Nguyen
CC BY-SA 4.0
2021-06-06T23:29:39.853Z
2021-06-11T12:35:31.510Z
2021-06-11T12:35:31.510Z
BKay
<p>DD models with heterogeneous effects mean that the treatment effect will change over time. For example, the impact of the law on a firms' profit will decay after years, the immediate effect is stronger than the treatment effect when time goes by.</p>
<p>In contrast, DD models with homogeneous effects mean that the treatment effects will be the same during the treatment period. It is less likely to happen in reality.</p>

CC BY-SA 4.0
2021-06-06T23:29:58.387Z
2021-06-06T23:29:58.387Z
Phil Nguyen
<p>Today, when reading <a href="https://www.nber.org/system/files/working_papers/w25018/w25018.pdf" rel="nofollow noreferrer">this paper</a>, page 3, I saw a sentence</p>
<blockquote>
<p>By decomposing the DD estimator into its sources of variation (the 2x2
DD’s) and providing an explicit interpretation of the weights in terms
of treatment variances, my results extend recent research on <strong>DD models
with heterogeneous effects</strong></p>
</blockquote>
<p>I do not understand what does &quot;<strong>DD models with heterogeneous effects</strong>&quot; mean?</p>
<p><strong>Update:</strong>
I saw <a href="https://stats.stackexchange.com/a/306490/319998">a discussion here</a> but still cannot separate DD with heteregeneous and DD with homogeneous effects.</p>
<p>DD is Difference-in-Difference</p>

CC BY-SA 4.0
2021-06-04T22:49:47.243Z
I found a [discussion](https://stats.stackexchange.com/questions/168607/difference-in-difference-with-heterogeneous-effects) here but it seems not to answer your question explicitly.
Phil Nguyen
CC BY-SA 4.0
2021-06-11T13:09:28.300Z
Fyi, check out the presentation by the author at the DiD reading group seminar (available on Youtube). He has a fantastically clear way of explaining it.
Papayapap
CC BY-SA 4.0
2021-06-12T05:39:07.840Z
I did a search but not yet found it, could you please give me a link, much appreciated. Thanks
Phil Nguyen
CC BY-SA 4.0
2021-06-12T08:37:04.400Z
https://www.youtube.com/watch?v=m1xSMNTKoMs
Papayapap
<econometrics>
What does "Difference-in-Diffrence" models with heterogeneous effects" mean?
Phil Nguyen
# What does "Difference-in-Diffrence" models with heterogeneous effects" mean?

(Asked by: username_0 on 2021-06-04)

Today, when reading [this paper](https://www.nber.org/system/files/working_papers/w25018/w25018.pdf), page 3, I saw a sentence

> By decomposing the DD estimator into its sources of variation (the 2x2
> DD’s) and providing an explicit interpretation of the weights in terms
> of treatment variances, my results extend recent research on **DD models
> with heterogeneous effects**

I do not understand what does "**DD models with heterogeneous effects**" mean?

**Update:**
I saw [a discussion here](https://stats.stackexchange.com/a/306490/319998) but still cannot separate DD with heteregeneous and DD with homogeneous effects.

DD is Difference-in-Difference

**Tags:** econometrics

> **Comments:**
> **username_0**: I found a [discussion](https://stats.stackexchange.com/questions/168607/difference-in-difference-with-heterogeneous-effects) here but it seems not to answer your question explicitly.  
> **username_1**: Fyi, check out the presentation by the author at the DiD reading group seminar (available on Youtube). He has a fantastically clear way of explaining it.  
> **username_0**: I did a search but not yet found it, could you please give me a link, much appreciated. Thanks  
> **username_1**: https://www.youtube.com/watch?v=m1xSMNTKoMs  

---

## 2 answers

### Answer by username_2 on 2021-06-06. Score: 2 | Accepted answer

Say you have a population of farmers that are very similar, to the point that we can think of them as largely homogeneous. In year 0 we record the agricultural productivity of 6% of the farmers. In year 1 we give pest resistant seeds to 1% (1/6th of the sample) for one year only and again record everyone's productivity. In year 2, we do the same thing with a different 1% getting free the pest resistant seeds . In year 3, we do it yet again with a third group of 1%. Further imagine that in the pests only attack in year 2.

In this world, agricultural productivity is going to be the same across the two groups in years 0, 1, and 3. Assuming no selection or other complex responses, only in year two will the productivity of the groups differ.

As I understand it, in a homogeneous Difference in Difference problem, we assume that the treatment effect (here getting the special seeds, which just as easily and legitimately could have been an intent to treat effect) is constant across time and groups (otherwise we are just investigating an average treatment effect), N.B. this problem doesn't have different groups. So if the productivity benefit on the treated group in year 2 was +30% to productivity, using all the years, and comparing them to the pre-treatment values, you'd get an average Difference in Difference treatment effect of about 10%. But, if we allowed for a heterogeneous treatment effect by year, we would see that the treatment effects would be +0%, +30%, and +0%.

Now, in this particular setting we may have enough periods, controls, and fixed effects that we can take care of this. Say, we could do a triple interaction with the presence of pests with the treatment year and the treatment population in that year. However, in more complex non-experimental settings, that won't generally be possible. We need a way to allow the effect of the treatment (or intent to treat) on the treated to vary across time and or groups. And that requires a model of "Difference-in-Difference” models with heterogeneous effects."

In a classic difference in difference model with one level of treatment and two time periods (pre- and post-treatment), we have a setup like this:

$$ y\_{i,t} = \beta\_0 + \beta\_1 \cdot 1\_{treat, i} + \beta\_2 \cdot 1\_{post, t} + \beta\_3 \cdot 1\_{treat, i} \cdot 1\_{post, t} + \epsilon\_{i,t}$$

The difference in difference estimator is $\beta\_3$, the change in the difference in the two groups over time. In the pest problem, $\beta\_3$ would be about 10%.

In our pest problem, if we wanted to do this as a triple interaction instead:

$$ y\_{i,t} = \gamma\_0 + \gamma\_1 \cdot 1\_{treat, i} + \gamma\_2 \cdot 1\_{post, t} + \gamma\_3 \cdot 1\_{pest, t} + \gamma\_4 \cdot 1\_{treat, i} \cdot 1\_{post, t} + \gamma\_5 \cdot 1\_{treat, i} \cdot 1\_{pest, t} + \gamma\_6 \cdot 1\_{post, i} \cdot 1\_{pest, t} + \gamma\_7 \cdot 1\_{treat, i} \cdot 1\_{post, i} \cdot 1\_{pest, t} + \zeta\_{i,t}$$
When we estimate this equation, $\gamma\_4=0$, but $\gamma\_7=0.3$.

The alternative, and probably more common setup, is to do it like this (as I understand it, this is a version of what the linked author does):

$$ y\_{i,t} = \alpha\_0 + \alpha\_1 \cdot 1\_{treat, i} + \alpha\_2 \cdot 1\_{i-ever-treated} + \sum\_{k=1}^T \alpha\_{2+k} \cdot 1\_{i-treated-in-year-k} \cdot 1\_{t=k} + \xi\_{i,t}$$

This gets you time varying DiD treatment effects by looking at the values of $\alpha\_{2+k}$. This is more common because we don't always have a hypothesis of how the DiD effects will vary over time, and so we don't know what moderating variable to use in the interaction in the second equation. Or sometimes we expect a treatment effect to build or shrink over time, but we want to know the speed and strength of that change for its own sake.

> **Comments:**
> **username_0**: Thank you for your answer , may I ask "**In this world, agricultural productivity is going to the same across the two groups in years 0, 1, and 3. Assuming no selection or other complex responses, only in year two will the productivity of the groups differ.**" do you mean it is the assumption for the real result?. And whether in your example, each year you only applie the pest resistant seeds for 1/6 of the whole sample, not accumulated (I mean, in year 3, only 1/6 being treated rather than 1/2)?  
> **username_0**: (2) I still not yet got the idea of "**Say, we could do a triple interaction with the presence of pests with the treatment year and the treatment population in that year **" Could you please clarify more about this idea?  
> **username_2**: In my example, to keep it as clear as possible and to not worry about complicating the interpretation of the coefficient in the Difference in Difference, I was assuming the special seeds were only used in one year.  By assuming no selection or other responses, I was trying to rule out things like more productive farms choosing to use the special seeds even though they didn't realize any benefits in the year of treatment. I'm trying to focus on treatment in the year of treatment only and show the average effect.  I will try to edit the problem soon to show a triple interaction example.  
> **username_0**: Thank you so much, when you finish editing, could you please comment here that I can come back to the post and learn from your example? Thank you.  
> **username_2**: @Knowledge-chaser , let me know if that clarifies  
> **username_0**: could you please check the **Math Processing Error** in your post, please? I misunderstood why there are two "=" signs  
> **username_0**: Ad from this [post](https://economics.stackexchange.com/questions/45329/what-are-the-meanings-of-difference-in-differences-and-causal-estimand), it seesm that $\beta_3$ is causal estimand, not difference-in-difference estimator? I am wondering  
> **username_0**: It is all okay until the second-to-last equation, I am wondering where $\gamma_1$ to $\gamma_7$ coming from, thank you  
> **username_2**: I fixed the $\gamma_7$ typo.  $\beta_3$  is the average difference between pre- and post- for the treated and control populations, so it is the diff in diff.  
> **username_0**: I understand the story now, thank you so much, username_2  

---

### Answer by username_0 on 2021-06-06. Score: -1

DD models with heterogeneous effects mean that the treatment effect will change over time. For example, the impact of the law on a firms' profit will decay after years, the immediate effect is stronger than the treatment effect when time goes by.

In contrast, DD models with homogeneous effects mean that the treatment effects will be the same during the treatment period. It is less likely to happen in reality.


---

