Daniel-Pailanir / sdid

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

Cannot draw graphs. Can you give some examples on how to draw graphs? #26

Closed TXU0429 closed 1 year ago

TXU0429 commented 2 years ago

Hi,

I have no problem running the numbers. But when I added graph to my code, suddenly the third variable does not exist.

sdid occupancy_rate record_id gap type, vce(placebo) seed(1234) graph ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50

Synthetic Difference-in-Differences Estimator


occupancy_rate | ATT Std. Err. t P>|t| [95% Conf. Interval] -------------+--------------------------------------------------

treatment | -0.06058 0.00648 -9.34 0.000 -0.07329 -0.04787

95% CIs and p-values are based on Large-Sample approximations. Refer to Arkhangelsky et al., (2020) for theoretical derivations. variable gap not found r(111);

My data is here: test.csv

I wonder what is wrong here and can you give some examples on how to draw the graphs?

Thank you!

TXU0429 commented 2 years ago

Update: My time period (the gap variable) was originally from -6 to 6.

When I use sdid occupancy_rate record_id gap type, vce(placebo) seed(1234) graph

It shows the error variable gap not found r(111);

But when I do gen year = gap + 1980

Then sdid occupancy_rate record_id gap type, vce(placebo) seed(1234) graph gives me the graph.

Don't understand why though.....

Daniel-Pailanir commented 2 years ago

hello @TXU0429 , we have a small bug with the graph option. At the moment you need the time variable named "year" for the graph output. ren gap year is an option to resolve the error.