Daniel-Pailanir / sdid

Synthetic Difference in Differences for Stata
GNU General Public License v3.0
74 stars 37 forks source link

Unit weight graphs for staggered adoption #65

Open mu2023 opened 7 months ago

mu2023 commented 7 months ago

Hi,

I would like to create the unit-specific weight graph under staggered adoption. I can get one using gr1 option but it is not customisable. I tried to replicate the code provided in Appendix 2 of the Stata Journal paper, but I wasn't successful. Do you have any example code that may help me to get the unit-specific graph for the staggered case?

Thank you.

damiancclarke commented 7 months ago

Hi, Have you downloaded the most recent version of sdid (avaialble with ssc install sdid, replace)? The code from the Stata Journal paper is based on this version of the ado, and so hopefully this should provide a useful example. Also, just for reference, with the most recent version of the code, graphs can now be saved as gph files, which means that you could save and edit directly if you prefer. Best wishes, Damian

mu2023 commented 7 months ago

Thanks for the very swift response Damian. Yes, indeed I have the most recent version of the sdid. From my reading of the Stata Journal paper, the Appendix 2 is an example for the conventional case, and when I try to replicate it for staggered adoption, I can't get a similar figure to that one (shown in Figure 1a or Figure 2 d) hen I use the gr1 option.

mu2023 commented 7 months ago

Hi Damian,

The example code works fine with the data you provided, but I am still not able to replicate it with my data. Unfortunately, I can't share an extract of the data, but essentially what I cannot get is the weighted markers for staggered treated groups. Do you have any idea why this might be happening?

Thanks.

damiancclarke commented 7 months ago

Hi again, thanks for the update on this. I believe there may have been a small issue exporting graphs as a .gph format, but one option which should work to give you editable graphs is as follows. If you use sdid and specify the g1on option (along with graph) this will ensure that weight graphs are produced. If you additionally request the graphs to be saved in gph format, these will be stored on your disk and can be edited. For example, using the staggered adoption case from the Stata help file and the following code generates a series of graphs starting with "sdidweights" for each adoption period.

sdid womparl country year quota, vce(bootstrap) seed(1213) g1on graph_export(sdid,.gph) graph

I'm not sure if this is what you're after? Please just note that to be sure the saving of the .gph format for graphs works, you will likely want to re-install the github version of the code that can be done as indicated on the github README. Hope this works!