I have the following dataset,
I have a staggered diff in diff setting. In the dataset, lead values correspond to the indicator variables for pre-treatment values, whereas lag values correspond to the indicator variables for post-treatment values. The dependent variable is sales. This is my code for the baseline plot:
This is the output:

Now I would like to see the effect of treatment on independent titles, for this I have a variable called independent. I have two questions regarding this. In a usual staggered diff in diff regression, without time-varying estimates, my code would be the following:
To show time varying effect, can I use:
If yes how can I make a similar plot to previous one but shows how the effect differs for the titles of independent artists (independent == 1) vs label artist (independent == 0). If no, what would be correct code to run the analysis and plot them? Better to run split sample analysis, if yes how can I combine plots from two different regressions?
Apologies for many questions...
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id monthly independent sales TreatZero lead2 lead3 lead4 lead5 lead6 lead7_backwards lag1 lag2 lag3 lag4 lag5 lag6 lead1) 1 672 0 249512 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 673 0 177712 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 674 0 109524 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 675 0 20776 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 676 0 846471 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 677 0 328806 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 678 0 46470 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 679 0 394758 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 680 0 301179 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 681 0 756129 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 682 0 116117 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 683 0 374293 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 684 0 432423 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 685 0 364780 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 686 0 797174 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 687 0 400569 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 688 0 126897 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2 672 1 65104 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 673 1 77133 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 674 1 76200 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 675 1 218342 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 676 1 39265 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 677 1 6649 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 678 1 41677 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 679 1 156277 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2 680 1 98535 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 681 1 3920 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2 682 1 165573 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 683 1 73413 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 684 1 97216 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2 685 1 106015 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 686 1 33066 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 687 1 54207 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2 688 1 118173 0 0 0 0 0 0 0 0 1 0 0 0 0 0 3 672 0 737203 0 0 0 0 0 0 1 0 0 0 0 0 0 0 3 673 0 306725 0 0 0 0 0 0 1 0 0 0 0 0 0 0 3 674 0 198990 0 0 0 0 0 0 1 0 0 0 0 0 0 0 3 675 0 1054751 0 0 0 0 0 0 1 0 0 0 0 0 0 0 3 676 0 1886147 0 0 0 0 0 1 0 0 0 0 0 0 0 0 3 677 0 1142545 0 0 0 0 1 0 0 0 0 0 0 0 0 0 3 678 0 1277825 0 0 0 1 0 0 0 0 0 0 0 0 0 0 3 679 0 397706 0 0 1 0 0 0 0 0 0 0 0 0 0 0 3 680 0 1354199 0 1 0 0 0 0 0 0 0 0 0 0 0 0 3 681 0 1348788 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 682 0 914274 1 0 0 0 0 0 0 0 0 0 0 0 0 0 3 683 0 805134 0 0 0 0 0 0 0 1 0 0 0 0 0 0 3 684 0 769588 0 0 0 0 0 0 0 0 1 0 0 0 0 0 3 685 0 292174 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 686 0 1236297 0 0 0 0 0 0 0 0 0 0 1 0 0 0 3 687 0 58338 0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 688 0 1681455 0 0 0 0 0 0 0 0 0 0 0 0 1 0 4 672 1 82611 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4 673 1 190401 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4 674 1 122867 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4 675 1 111444 0 0 0 0 0 0 1 0 0 0 0 0 0 0 4 676 1 44781 0 0 0 0 0 1 0 0 0 0 0 0 0 0 4 677 1 158895 0 0 0 0 1 0 0 0 0 0 0 0 0 0 4 678 1 71693 0 0 0 1 0 0 0 0 0 0 0 0 0 0 4 679 1 62140 0 0 1 0 0 0 0 0 0 0 0 0 0 0 4 680 1 321720 0 1 0 0 0 0 0 0 0 0 0 0 0 0 4 681 1 188944 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 682 1 179921 1 0 0 0 0 0 0 0 0 0 0 0 0 0 4 683 1 159214 0 0 0 0 0 0 0 1 0 0 0 0 0 0 4 684 1 118173 0 0 0 0 0 0 0 0 1 0 0 0 0 0 4 685 1 246030 0 0 0 0 0 0 0 0 0 1 0 0 0 0 4 686 1 83191 0 0 0 0 0 0 0 0 0 0 1 0 0 0 4 687 1 100867 0 0 0 0 0 0 0 0 0 0 0 1 0 0 4 688 1 42409 0 0 0 0 0 0 0 0 0 0 0 0 1 0 5 672 0 32247 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 673 0 9993 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 674 0 44384 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 675 0 28284 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 676 0 6873 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 677 0 35780 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 678 0 226 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 679 0 41062 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 680 0 34161 0 0 0 0 0 0 1 0 0 0 0 0 0 0 5 681 0 5773 0 0 0 0 0 1 0 0 0 0 0 0 0 0 5 682 0 12586 0 0 0 0 1 0 0 0 0 0 0 0 0 0 5 683 0 22660 0 0 0 1 0 0 0 0 0 0 0 0 0 0 5 684 0 40637 0 0 1 0 0 0 0 0 0 0 0 0 0 0 5 685 0 40881 0 1 0 0 0 0 0 0 0 0 0 0 0 0 5 686 0 3560 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 687 0 9365 1 0 0 0 0 0 0 0 0 0 0 0 0 0 5 688 0 852 0 0 0 0 0 0 0 1 0 0 0 0 0 0 6 672 0 94715 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 673 0 2692 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 674 0 123457 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 675 0 724462 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 676 0 871857 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 677 0 16821 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 678 0 499244 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 679 0 441009 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 680 0 429921 0 0 0 0 0 0 1 0 0 0 0 0 0 0 6 681 0 156341 0 0 0 0 0 1 0 0 0 0 0 0 0 0 6 682 0 461273 0 0 0 0 1 0 0 0 0 0 0 0 0 0 6 683 0 325237 0 0 0 1 0 0 0 0 0 0 0 0 0 0 6 684 0 302210 0 0 1 0 0 0 0 0 0 0 0 0 0 0 6 685 0 332281 0 1 0 0 0 0 0 0 0 0 0 0 0 0 6 686 0 298871 0 0 0 0 0 0 0 0 0 0 0 0 0 0 end format %tm monthly
Code:
xtset id monthly xtreg sales lead7_backwards lead6 lead5 lead4 lead3 lead2 lead1 TreatZero lag1 lag2 lag3 lag4 lag5 lag6 i.monthly, fe vce(cluster id) coefplot, vertical omitted keep(lead6 lead5 lead4 lead3 lead2 lead1 TreatZero lag1 lag2 lag3 lag4 lag5 lag6) ciopts(recast(rcap)) yline(0) msymbol(d)
Now I would like to see the effect of treatment on independent titles, for this I have a variable called independent. I have two questions regarding this. In a usual staggered diff in diff regression, without time-varying estimates, my code would be the following:
Code:
xtreg sales i.treatment##i.independent, fe vce(cluster id)
Code:
xtreg sales i.(lead7_backwards lead6 lead5 lead4 lead3 lead2 lead1 TreatZero lag1 lag2 lag3 lag4 lag5 lag6)##i.independent i.monthly, fe vce(cluster id)
Apologies for many questions...
Comment