Is there any easy way to get line diagram like this in Stata? Revenue is continuous variable, Acquisition Channel is nominal variable, and test_coupon is dummy. The best I get is this:
Obviously, this is a lot of code for simple graph, and there is no error bars around means.
Code:
. gen means=. . tabstat revenue_after if test_coupon == 0, by(channel_acq) . replace means = 4.92 if channel_acq == 1 & test_coupon == 0 . replace means = 9.81 if channel_acq == 2 & test_coupon == 0 . replace means = 9.17 if channel_acq == 3 & test_coupon == 0 . replace means = 11.18 if channel_acq == 4 & test_coupon == 0 . replace means = 14.86 if channel_acq == 5 & test_coupon == 0 . tabstat revenue_after if test_coupon == 1, by(channel_acq) . replace means = 2.80 if channel_acq == 1 & test_coupon == 1 . replace means = 10.90 if channel_acq == 2 & test_coupon == 1 . replace means = 10.34 if channel_acq == 3 & test_coupon == 1 . replace means = 11.52 if channel_acq == 4 & test_coupon == 1 . replace means = 12.76 if channel_acq == 5 & test_coupon == 1 . line means channel_acq if test_coupon == 0 || line means channel_acq if test_coupon == 1, lpattern(dash)
Comment