Building off of the example shown here: https://www.statalist.org/forums/new-content/51
I'm attempting to do something similar in reporting percent change with confidence intervals compared to some baseline period.
The issue that I encounter is trying to calculate a percent change compared to the baseline period (period of interest/baseline-1)*100). Is there a way to generate a percent change in the right direction? For example, one is positive and one is negative while the formula has both as positive.
Thanks,
I'm attempting to do something similar in reporting percent change with confidence intervals compared to some baseline period.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float ac_drug_oral double volume_per10000 byte period float(monthly ln_volume_per10000) 2 1260.6831300832241 1 732 7.139409 2 1121.1703693867348 1 733 7.022129 2 1297.5034939189118 1 734 7.168197 2 1244.835560987853 1 735 7.126759 2 1209.8619960138883 1 736 7.098261 2 1276.7094465389555 1 737 7.152041 2 1257.8345016583257 1 738 7.137147 2 1250.1367395163436 1 739 7.131008 2 1194.3472777250283 1 740 7.085355 2 1217.227766272708 1 741 7.104331 2 1188.4083496816286 1 742 7.08037 2 1220.8647452373323 1 743 7.107315 2 1195.1871343100497 2 744 7.086058 2 1093.872239363099 2 745 6.997479 2 1217.4365842951077 2 746 7.104503 2 1155.7952853628883 2 747 7.052544 2 1183.4685905249155 2 748 7.076205 2 1180.5756265808982 2 749 7.073758 2 1148.722932051039 3 750 7.046406 2 1206.729594179629 3 751 7.095669 2 1119.5237418002291 3 752 7.020658 2 1132.7168821291311 3 753 7.032374 2 1107.2286632215928 3 754 7.009615 2 1137.4805390050224 3 755 7.036571 end format %tm monthly
reg ln_volume_per10000 i.period contrast r.period nlcom 100*(1-exp(_b[2.period])) nlcom 100*(1-exp(_b[3.period]))
Thanks,
Comment