**Lecture 5: Visualizing data cd "/Users/crystal/Box/_Biostat212_2021/Week5/Lecture" use data/acupuncture.dta, clear **************************************************************************** *Figure 1 twoway /// scatter posths acuptreatments if migraine==0 /// , msize(tiny) mcolor(orange) msymbol(d) || /// lfit posths acuptreatments if migraine==0 /// , lcolor(orange) || /// scatter posths acuptreatments if migraine==1 /// , msize(tiny) mcolor(green) jitter(2) || /// lfit posths acuptreatments if migraine==1 /// , lcolor(green) || /// , title (Figure 1: Acupuncture treatments and headache score) /// note (Lecture 5 practice) /// ytitle(Post-study headache score) /// xtitle(Number of acupuncture treatments) /// scheme(s1mono) /// legend(order(2 "No migraine" 4 "Migraine")) /// saving("output/figure1.gph", replace) **************************************************************************** *Figure 2 twoway /// kdensity posths if no_acu==0 /// , lcolor(gray) || /// kdensity posths if no_acu==1 /// , lcolor(black) || /// , yscale(off) /// graphregion(fcolor(white)) /// legend(order(1 "1 or more acupuncture treatments" /// 2 "No acupuncture treatments") size(small)) /// ytitle("Density") /// xtitle("Post-study headache score") /// title(Figure 2: Distribution of headache score) /// saving("output/figure2.gph", replace)