I have a simple bivariate regression model with an interaction term:
reg DP ln(IV) MOD ln(IV)*MOD
I want to plot the regression line for different values of MOD, to look something like the below:
I have tried to do this with margin and marginsplot commands, but I only get linear results (see attachment)
I would be grateful for your help!
Kind regards,
Jakob
reg DP ln(IV) MOD ln(IV)*MOD
I want to plot the regression line for different values of MOD, to look something like the below:
I have tried to do this with margin and marginsplot commands, but I only get linear results (see attachment)
Code:
reg povertyline logdeficit gini interact_gini margins, at(gini=(30 36 42)) marginsplot
I would be grateful for your help!
Kind regards,
Jakob
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float iso3n double gini float(logdeficit interact_gini) 926 29 . . 499 36.9 . . 36 34 3.330491 113.2367 554 . 2.964826 . 52 . . . 136 . . . 214 42.2 2.3475068 99.06479 780 . 3.2702994 . 662 . . . 308 . . . 212 . . . 670 . . . 659 . . . 533 . . . 332 . . . 28 . . . 850 . . . 192 . . . 630 . . . 388 . 2.432784 . 44 . . . 591 49.9 2.499323 124.71622 222 38 1.840707 69.94687 340 49.4 1.6871662 83.34601 188 48.3 2.2543366 108.88446 320 . 1.407686 . 558 . 1.7681222 . 484 47.200000000000045 2.5772305 121.64528 84 . . . 860 . . . 398 27.5 3.038216 83.55094 795 . . . 762 . 2.036664 . 417 27.3 2.340101 63.88476 450 43.09999999999985 .9080942 39.13886 834 40.11428571428564 .7790053 31.24924 262 41.6 . . 716 44.3 1.8018782 79.8232 480 36.8 2.52604 92.95828 706 . . . 231 35.72000000000003 1.251808 44.71458 232 . . . 646 43.23333333333346 .6104927 26.393635 800 42.766666666666666 -.3747015 -16.024733 894 57.70000000000016 1.0381508 59.9013 174 . . . 108 . . . 690 35.04000000000087 . . 508 . 1.3518612 . 404 . 1.290814 . 454 42.63333333333321 -2.3025696 -98.16622 446 . . . 408 . . . 156 39.1 2.7687166 108.25682 410 31.50000000000003 3.1917524 100.5402 496 32.5 2.960529 96.21719 344 . 3.112752 . 392 33.96666666666624 3.1168535 105.86913 203 24.9 3.1798506 79.17828 804 26 2.725242 70.85629 642 36 2.639316 95.01538 498 25.9 . . 100 40.4 2.7824554 112.4112 348 30.6 2.8531375 87.30601 112 25.4 2.814378 71.4852 810 37.2 3.039144 113.05617 616 29.7 2.986573 88.70123 703 23.2 2.929394 67.96194 598 . . . 242 32.69999999999982 . . 90 . . . 548 33.433333333333394 . . 296 . . . 583 . . . 520 . . . 316 . . . 585 . . . 584 . . . 180 . . . 266 38 . . 178 . . . 148 38.32857142857142 . . 226 . . . 24 . . . 678 40.7 . . 120 . 1.4908074 . 140 . . . 788 31.59999999999968 2.2922888 72.436325 504 . 1.976289 . 434 . . . 728 . . . 736 . . . 818 31.5 1.990596 62.70378 12 . . . 124 33.3 3.306146 110.09466 840 41.2 3.423671 141.05525 304 . . . 60 . . . 578 27 3.093841 83.53371 208 28.7 3.084956 88.53824 end
Comment