Dear colleagues,
I ran a difference-in-differences model and I would like to visually validate the parallel-trends assumption using conditional means rather than ordinary means. If I am using ordinary means, I would run the commands below. But how can I test for parallel trends if I would like to condition my (mean) outcome variable on the two variables "control1" and "control2"? I attach a sample of the data I am using. Thanks in advance.
I ran a difference-in-differences model and I would like to visually validate the parallel-trends assumption using conditional means rather than ordinary means. If I am using ordinary means, I would run the commands below. But how can I test for parallel trends if I would like to condition my (mean) outcome variable on the two variables "control1" and "control2"? I attach a sample of the data I am using. Thanks in advance.
Code:
xtset id year collapse (mean) outcome, by(treated year) xtset treated year xtline outcome, overlay title(outcome_variable)
id | year | outcome | control1 | control2 | treated |
1 | 2015 | 30 | 14.47 | 5.94 | 0 |
1 | 2016 | 45 | 14.47 | 5.94 | 0 |
1 | 2017 | 20 | 14.47 | 5.94 | 0 |
1 | 2018 | 15 | 14.47 | 5.94 | 0 |
1 | 2019 | 40 | 14.47 | 5.94 | 0 |
1 | 2020 | 65 | 14.47 | 5.94 | 0 |
2 | 2015 | 40 | 42.89 | 3.64 | 1 |
2 | 2016 | 55 | 42.89 | 3.64 | 1 |
2 | 2017 | 30 | 42.89 | 3.64 | 1 |
2 | 2018 | 25 | 42.89 | 3.64 | 1 |
2 | 2019 | 50 | 42.89 | 3.64 | 1 |
2 | 2020 | 100 | 42.89 | 3.64 | 1 |
3 | 2015 | 20 | 48.52 | 7.93 | 0 |
3 | 2016 | 35 | 48.52 | 7.93 | 0 |
3 | 2017 | 10 | 48.52 | 7.93 | 0 |
3 | 2018 | 5 | 48.52 | 7.93 | 0 |
3 | 2019 | 30 | 48.52 | 7.93 | 0 |
3 | 2020 | 55 | 48.52 | 7.93 | 0 |
Comment