Hello,
I’m using STATABE/17.0 and I have troubles with the left and right axis of my twoway scatter + line diagram. Even though I selected yaxis(2) for the line, its scale shows up on the left.
I created a twoway scatter diagram that shows the estimated coefficients of the impact of a stay-in-school program on the students grade, depending on the number of days they participated in the program. For each estimate, we raised the minimum of days required to be included in the treated group for the regression by 30 days, so as the number of days goes up, the number of treated students in the treated group (variable “treated”) goes down. The variable “proportion” shows the proportion of the initial 315 students that are considered treated for that number of days.
Any other suggestions on how to present the data more aesthetically is welcomed also.
Thank you for your help,
Nicolas
I’m using STATABE/17.0 and I have troubles with the left and right axis of my twoway scatter + line diagram. Even though I selected yaxis(2) for the line, its scale shows up on the left.
I created a twoway scatter diagram that shows the estimated coefficients of the impact of a stay-in-school program on the students grade, depending on the number of days they participated in the program. For each estimate, we raised the minimum of days required to be included in the treated group for the regression by 30 days, so as the number of days goes up, the number of treated students in the treated group (variable “treated”) goes down. The variable “proportion” shows the proportion of the initial 315 students that are considered treated for that number of days.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(days treated proportion) double(estimate min95 max95) 30 314 .9968254 .046494984169676644 -1.9137120599203097 2.006702028259663 60 312 .9904762 .046494984169676644 -1.9137120599203097 2.006702028259663 90 307 .9746032 .7679641564922828 -1.2171593010667443 2.75308761405131 120 304 .9650794 .7053769464142945 -1.3752948607208155 2.7860487535494043 150 303 .9619048 .7053769464142945 -1.3752948607208155 2.7860487535494043 180 299 .9492064 .7496901996016438 -1.094470087186972 2.5938504863902594 210 288 .9142857 .8744209239132374 -.937688168573908 2.6865300164003827 240 283 .8984127 1.0652281440416944 -.6800340685545461 2.810490356637935 270 277 .8793651 1.2252341610868356 -.5849420620836219 3.0354103842572933 300 269 .8539683 1.622480267793473 -.09256744557846797 3.3375279811654144 330 266 .8444445 1.6464548726504031 -.0454302588594071 3.338340004160213 360 262 .831746 1.7303964507057465 .031639609180645456 3.429153292230848 390 252 .8 2.1070893356168483 .3949298994637567 3.81924877176994 420 244 .7746032 2.7412028929879013 .8906725894595471 4.591733196516255 450 238 .7555556 2.3624295839629177 .7458820651322966 3.9789771027935386 480 233 .7396826 2.7401356084756063 1.2453542045037043 4.234917012447508 510 229 .7269841 3.2365693377283065 1.6689275614528654 4.804211114003747 540 225 .7142857 2.9633489603477297 1.4576143258043381 4.469083594891121 570 222 .7047619 3.0624508868160554 1.5549986274808616 4.569903146151249 600 216 .6857143 2.9580537025950657 1.500419624515906 4.415687780674226 630 214 .6793651 2.802549173921975 1.362511785432553 4.242586562411397 660 205 .6507937 2.8552935302961844 1.6429667871494913 4.067620273442877 690 199 .6317461 2.60091867213188 1.4055934379393151 3.796243906324445 720 196 .6222222 2.862556692980679 1.7134561672942563 4.011657218667102 750 190 .6031746 3.020192408941428 1.7886077570320789 4.2517770608507774 780 180 .5714286 3.270420375869851 2.1572063649020325 4.383634386837669 810 179 .568254 3.2798848434042385 2.1580191162282016 4.401750570580275 840 178 .5650794 3.334238577065541 2.190461802392833 4.478015351738249 870 174 .552381 3.2029810659708073 1.9022880866712197 4.503674045270395 900 171 .54285717 3.2249530746133077 1.7909727176552197 4.658933431571396 930 169 .53650796 2.9694181687471892 1.4199996720686934 4.518836665425685 960 165 .52380955 2.9693774549328418 1.4562584482583165 4.482496461607367 990 160 .50793654 3.1921786652969804 1.5952422399213306 4.78911509067263 1020 159 .50476193 3.1921786652969804 1.5952422399213306 4.78911509067263 1050 153 .4857143 3.0669962431122233 1.3994037984757741 4.734588687748673 1080 145 .4603175 3.3090450937010547 1.6462209310607643 4.971869256341345 1110 142 .45079365 3.728517834601178 2.228913350223377 5.228122318978979 1140 140 .44444445 3.7170518592235777 2.3227947841369128 5.111308934310243 1170 137 .4349206 3.5958287913156295 1.9852390918627096 5.20641849076855 1200 136 .431746 3.6005460550636914 1.9264560953962446 5.274636014731138 1230 136 .431746 3.6005460550636914 1.9264560953962446 5.274636014731138 1260 134 .4253968 3.720102331499618 1.9221698018836166 5.51803486111562 1290 132 .4190476 3.948177458153095 2.0506693790139403 5.845685537292249 1320 131 .415873 3.6746230141674796 1.668615296676586 5.680630731658374 1350 129 .4095238 3.6848180255306016 2.035406144410557 5.334229906650647 1380 117 .3714286 3.9744511535877236 2.51210689875867 5.436795408416778 1410 110 .3492064 3.9437167422282013 2.473638267386958 5.4137952170694446 1440 100 .3174603 4.5122724855936855 2.935768996508071 6.0887759746793 1470 96 .3047619 4.679545651356969 2.915008202769464 6.444083099944475 1500 96 .3047619 4.679545651356969 2.915008202769464 6.444083099944475 1530 93 .2952381 4.791127198504803 2.9017299378344097 6.680524459175197 1560 90 .2857143 4.535125545765046 2.68041710129408 6.389833990236013 1590 87 .2761905 4.56434819372004 2.7865120368652256 6.342184350574854 1620 85 .26984128 4.711305948546441 3.112012418437499 6.310599478655383 1650 83 .26349208 4.696330087243326 3.1017411347269785 6.2909190397596735 1680 82 .26031747 4.5760002676350275 2.9981085791176625 6.153891956152393 1710 80 .25396827 4.298243982053482 2.6962880990034757 5.900199865103489 1740 73 .23174603 4.386591953033458 2.5268607287775184 6.246323177289397 end
Code:
twoway (line proportion days, yaxis(2))(scatter estimate days, yaxis(1) legend(region(col(white))) yscale(titlegap(2)) xscale(range(0 1800) titlegap(2)) msymbol(square) msize(small))(rcap min95 max95 days, lcolor(blue)), xlabel(0(250)1750, valuelabels angle(0) labsize(small)) xtitle("Number of days") ytitle("Grade variation (%)", axis(1)) ytitle("Proportion", axis(2)) ysca(titlegap(2)) ylab(, labs(small)) xsca(titlegap(2)) yline(0, lcolor(red)) graphregion(color(white)) ylabel(-2 (2) 8, axis(1)) ylabel(, axis(2))
Any other suggestions on how to present the data more aesthetically is welcomed also.
Thank you for your help,
Nicolas
Comment