I'm studying the causal impact of Puerto Rico's VacuTour policy with my event-study synthetic control estimator. I want to give myself and other users of my command the ability to average and graph their pointwise effects within whatever temporal window they choose. This is partly so folks can see the causal effect better, but also since some policies may not have very long term effects (i.e., until the end of the time series). In my case, I want to force the x-axis, the relative time axis, to be within 28 periods before the intervention and 28 periods afterwards.
I figured we'd naturally use the -if- option since that'll restrict our sample however we choose. However, when I try this, Stata returns to me the graph I desire, but the x-axis extends from 40 days before to 40 days after, which could give readers and others the wrong impression. All I want, is to force the x-axis to be within -28/28. Here's my code.
I know Stata under the hood has her own rules about axis making, so if there's no easy way to do this it isn't the end of the world, I just wanted to see if it were possible. Oh, and note that my default scheme is gg_tableau, but I suspect this won't likely matter to my question.
I figured we'd naturally use the -if- option since that'll restrict our sample however we choose. However, when I try this, Stata returns to me the graph I desire, but the x-axis extends from 40 days before to 40 days after, which could give readers and others the wrong impression. All I want, is to force the x-axis to be within -28/28. Here's my code.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(relative_ diff_ lowbound_ upbound_) -28 -.23405184 -40.92885 40.46075 -27 -.21228437 -40.90708 40.48251 -26 -2.8375804 -43.53238 37.857216 -25 1.6115553 -39.08324 42.30635 -24 .4068981 -40.2879 41.1017 -23 .4525818 -40.24222 41.14738 -22 -1.950658 -42.64546 38.74414 -21 -1.7958262 -42.49063 38.89898 -20 -.4942572 -41.18906 40.20054 -19 -3.309373 -44.00417 37.385426 -18 -.57243955 -41.26724 40.12236 -17 2.569238 -38.12556 43.26404 -16 2.427209 -38.26759 43.12201 -15 1.0074625 -39.68734 41.70226 -14 1.0761077 -39.61869 41.77091 -13 -1.523999 -42.2188 39.1708 -12 -.9060938 -41.60089 39.78871 -11 .6814575 -40.01334 41.37626 -10 2.1758146 -38.51898 42.87061 -9 3.407859 -37.28694 44.10266 -8 4.730154 -35.964645 45.42495 -7 -1.399982 -42.09478 39.29482 -6 .13326946 -40.56153 40.82807 -5 1.9785467 -38.71625 42.67334 -4 2.253932 -38.44086 42.94873 -3 5.074914 -35.619884 45.76971 -2 4.2422204 -36.45258 44.93702 -1 5.072356 -35.622444 45.76715 0 -8.734286 -49.42908 31.96051 1 1.1307629 -39.56403 41.82556 2 7.365439 -33.32936 48.06024 3 6.7859 -33.908897 47.4807 4 10.42575 -30.26905 51.12055 5 9.159128 -31.53567 49.85393 6 8.031276 -32.66352 48.72607 7 11.757857 -28.93694 52.45266 8 -6.303397 -46.99819 34.391403 9 -11.902307 -52.59711 28.79249 10 -8.759895 -49.45469 31.9349 11 -26.40079 -67.09559 14.294008 12 -32.28964 -72.984436 8.405159 13 -31.45153 -72.146324 9.243271 14 -35.57741 -76.27221 5.117386 15 -32.969852 -73.66465 7.724947 16 -38.73798 -79.43278 1.956817 17 -47.03251 -87.72731 -6.337713 18 -59.44791 -100.1427 -18.75311 19 -59.10678 -99.80157 -18.41198 20 -74.3221 -115.0169 -33.627296 21 -77.36971 -118.0645 -36.674904 22 -88.54966 -129.24446 -47.85486 23 -90.35377 -131.04857 -49.65897 24 -94.14935 -134.84416 -53.45456 25 -97.99923 -138.69403 -57.30443 26 -99.54365 -140.23845 -58.84885 27 -108.90373 -149.59853 -68.20893 28 -105.69733 -146.39214 -65.00253 end qui su diff if rel >= 0, mean loc ATT: disp %6.4g `r(mean)' loc before = 28 loc after = 28 loc intname "Vacutour" tw /// (connected diff_ relative_, /// Plot 1, Average Lines mcolor("0 142 234") msize(medium) /// msymbol(circle) lcolor("0 142 234") lwidth(medium)) /// (rarea lowbound_ upbound_ relative_, /// plot 2, 95% CIs fcolor("252 201 185 %40") lcolor("252 201 185 %40")) if inrange(rel,-`before',`after'), /// legend(order(1 "ATT" 2 "Confidence Interval") pos(7) ring(0)) /// other graph options note("ATT = `ATT', adjusted for imbalances in event-time.") /// xti("Time Relative to `intname'") name(eventplot, replace) scheme(`scheme') /// yti("Pointwise ATT") xli(0, lcol(blue) lwidth(thick)) /// ti("SCUL, Event-Study")
Comment