Hi,
I'm trying to test for parallel trends in a DiD using the following data:
y=outcome variable
mdate_birth=month-year of birth
ym_born_after= whether month-year of birth is after policy introduction
treatmentstate=whether state has policy
year_born=year of birth
I performed DiD with following specification:
I now want to test for parallel trends using leads and lags of interaction between time dummy and treatment dummy, as shown in https://stats.stackexchange.com/a/160361
Thus in my case leads and lags on (dummies from mdate_birth)*treatmentstate
However I have numerous values of mdate_birth and thus makes it impossible to enter all of these interaction terms by hand in the regression equation. Is there any simpler way of doing this test using the method I outlined?
Secondly I want to produce graphs that look like the one attached
I have been using a simple line graph but they dont look very nice and would appreciate any help.
Please let me know if you need further clarifications to answer this question. Looking forward to your reply.
I'm trying to test for parallel trends in a DiD using the following data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long state int year_born float(y mdate_birth ym_born_after treatmentstate) 3 2001 0 492 0 1 30 2001 0 499 0 0 24 2001 0 503 0 0 23 2001 0 497 0 0 36 2001 0 492 0 0 30 2001 0 500 0 0 23 2001 0 499 0 0 23 2001 0 500 0 0 23 2001 0 497 0 0 23 2001 0 500 0 0 3 2001 0 503 0 1 24 2001 0 502 0 0 10 2001 0 493 0 0 3 2001 0 499 0 1 23 2001 0 492 0 0 23 2001 0 492 0 0 30 2001 0 494 0 0 20 2001 0 502 0 0 20 2001 0 494 0 0 24 2001 0 497 0 0 24 2001 0 499 0 0 23 2001 0 501 0 0 30 2001 0 501 0 0 36 2001 0 493 0 0 10 2001 0 503 0 0 24 2001 0 496 0 0 23 2001 0 501 0 0 24 2001 0 496 0 0 24 2001 0 494 0 0 30 2001 0 497 0 0 30 2001 0 503 0 0 23 2001 0 502 0 0 10 2001 0 501 0 0 23 2001 0 493 0 0 24 2001 1 499 0 0 23 2001 0 501 0 0 36 2001 0 492 0 0 20 2001 0 498 0 0 10 2001 0 501 0 0 3 2001 0 494 0 1 36 2001 1 500 0 0 36 2001 0 499 0 0 23 2001 0 497 0 0 36 2001 0 498 0 0 36 2001 0 503 0 0 23 2001 0 502 0 0 23 2001 1 493 0 0 20 2001 0 494 0 0 36 2001 1 503 0 0 24 2001 0 494 0 0 10 2001 0 492 0 0 36 2001 0 500 0 0 30 2001 0 503 0 0 23 2001 0 499 0 0 30 2001 0 501 0 0 23 2001 0 495 0 0 24 2001 0 499 0 0 10 2001 0 500 0 0 23 2001 0 500 0 0 36 2001 0 503 0 0 30 2001 0 494 0 0 20 2001 0 498 0 0 30 2001 0 500 0 0 20 2001 0 492 0 0 24 2001 0 495 0 0 23 2001 0 495 0 0 20 2001 0 503 0 0 36 2001 0 496 0 0 36 2001 0 494 0 0 10 2001 0 497 0 0 30 2001 0 497 0 0 10 2001 0 501 0 0 24 2001 1 492 0 0 30 2001 0 492 0 0 20 2001 0 493 0 0 23 2001 0 502 0 0 30 2001 0 500 0 0 24 2001 0 495 0 0 3 2001 0 492 0 1 36 2001 0 499 0 0 23 2001 0 499 0 0 20 2001 0 496 0 0 30 2001 0 499 0 0 23 2001 0 502 0 0 36 2001 0 501 0 0 23 2001 0 496 0 0 20 2001 1 503 0 0 3 2001 0 502 0 1 36 2001 0 495 0 0 10 2001 0 493 0 0 36 2001 0 503 0 0 20 2001 0 495 0 0 36 2001 0 499 0 0 36 2001 0 492 0 0 20 2001 1 503 0 0 30 2001 1 502 0 0 30 2001 0 503 0 0 24 2001 0 494 0 0 3 2001 0 502 0 1 36 2001 0 492 0 0 end format %tm mdate_birth label values state state1 label values y binarylabel
mdate_birth=month-year of birth
ym_born_after= whether month-year of birth is after policy introduction
treatmentstate=whether state has policy
year_born=year of birth
I performed DiD with following specification:
Code:
areg y i.treatmentstate##i.ym_born_after i.state, absorb(year_born) cluster(cluster)
Thus in my case leads and lags on (dummies from mdate_birth)*treatmentstate
However I have numerous values of mdate_birth and thus makes it impossible to enter all of these interaction terms by hand in the regression equation. Is there any simpler way of doing this test using the method I outlined?
Secondly I want to produce graphs that look like the one attached
I have been using a simple line graph but they dont look very nice and would appreciate any help.
Please let me know if you need further clarifications to answer this question. Looking forward to your reply.
Comment