Hi,
I am running a regression of the form:
where I interact two continous variables. I would like to create a margins plot with the following format:
Normally I would use:
where in "?" I would specify the levels, but I am not sure how to do it with a continous variable.
An example of my data is:
I am running a regression of the form:
Code:
reg y_var c.x_var##c.inter_var
Normally I would use:
Code:
margins, dydx(x_var) at(inter_var=(?))
An example of my data is:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(y_var x_var inter_var) .5714286 0 .4047619 .4047619 0 .4558823 .59366393 0 .2712224 .3471569 .05300756 .10421521 .6285715 0 .11 .5 .028987536 .2352941 .5914634 0 .22988385 .3675947 .0891891 .1805922 .7055879 0 .24351773 .456893 .07331297 .18184166 .6387016 0 .25089714 .39703155 .1042697 .1649172 .7121523 0 .21293853 .4856865 .08149637 .2257634 .55119824 0 .2364341 .3637593 .0717025 .18970737 .6414383 0 .23691233 .3628412 .09411559 .12715682 .640048 0 .1985592 .3878999 .08719668 .13754296 .5907591 0 .2010135 .3855799 .0924699 .2052545 .54418606 0 .27065304 .3584131 .05004835 .13919128 .6579425 0 .23953563 .4383174 .09527703 .16684346 .653834 0 .26696637 .4039878 .0818624 .12373408 .6480492 0 .2597146 .3564334 .063836135 .05905572 .6461539 0 .1011236 .578125 0 .23333333 .6404495 0 .206057 .399264 .04742869 .15085714 .6046967 0 .2084354 .3789108 .09445875 .15795745 .6496881 0 .27283654 .4826884 .07605837 .16696376 .58762884 0 .1707317 .5603448 .2177235 .26576576 .6180905 0 .2026316 .4987893 .0874403 .23938224 .5366717 0 .18856515 .26013118 .0686732 .11280713 .6523408 0 .19432606 .425641 .08537883 .1207099 .5263158 0 .27317074 .3 .10584583 .184466 .3624595 0 .21183206 .2962963 .14848815 .2826087 .5794066 0 .2404061 .3498973 .07542813 .1222119 .6213018 0 .22983015 .4231651 .0911715 .18172537 .6965812 0 .20095885 .56186867 .04572668 .1550357 .58810574 0 .18121693 .449807 .09124868 .1643312 .6179941 0 .2407199 .4827109 .10437319 .16703217 .535093 0 .24053966 .3935103 .0888148 .21496554 .6848225 0 .2345965 .3805128 .06090141 .1110663 .5519341 0 .26956522 .306804 .0999722 .12772585 .5709459 0 .1588367 .4089347 .07745805 .2751678 .6393443 0 .24676616 .4420732 .08030143 .17635752 .5981839 0 .2456326 .4130536 .08042275 .1042913 .6356142 0 .2326611 .4576547 .0828319 .26104024 .6965265 0 .23413037 .4830468 .09650812 .17099236 .6481481 0 .13333334 .6057692 .09418721 .2962963 .6789274 0 .2558149 .4481335 .08645687 .1385835 .6109527 0 .23182553 .34515965 .08436964 .08669516 .5108932 0 .2336232 .3667992 .0760269 .194958 .57123286 0 .22833665 .3592096 .08799201 .18285504 .6652968 0 .2174151 .4391356 .0711862 .1184182 .6388318 0 .2650733 .42177585 .07909735 .13423698 .6167904 0 .20551883 .4166256 .070240036 .14834623 .6844171 0 .25854677 .4452518 .1086528 .14206716 .7015707 0 .27769986 .51666665 .04727416 .1604426 .7541912 0 .25053576 .52555406 .09031504 .19982554 .5801282 0 .2161235 .3344848 .09601896 .111332 end
Comment