Hi,
I have created a two-way scatter plot of mean hdl-cholesterol over study duration by group (2 groups) in stata using the following code (hdl= hdl-cholesterol, grp=group, and yrsbsl= years since baseline):
collapse (mean) m_hdl = hdl (semean) se_hdl = hdl, by(grp yrsbsl)
gen x = _n
gen m_hdl_u = m_hdl + 1.96*se_hdl
gen m_hdl_l = m_hdl - 1.96*se_hdl
twoway (scatter m_hdl yrsbsl if grp==1) ///
(rcap m_hdl_u m_hdl_l yrsbsl if grp==1) ///
(line m_hdl yrsbsl if grp==1) ///
(scatter m_hdl yrsbsl if grp==0) ///
(rcap m_hdl_u m_hdl_l yrsbsl if grp==0) ///
(line m_hdl yrsbsl if grp==0)
ytitle (Mean HDL-cholesterol over time)
I want to manually add an asterix above each time-point to show if means were significantly different between groups at each timepoint. Is there a way to add those asterix? Better yet, is there a way for stata to auto calculate whether or not means are statistically different at each time-point and add and asterix automatically?
Thanks
I have created a two-way scatter plot of mean hdl-cholesterol over study duration by group (2 groups) in stata using the following code (hdl= hdl-cholesterol, grp=group, and yrsbsl= years since baseline):
collapse (mean) m_hdl = hdl (semean) se_hdl = hdl, by(grp yrsbsl)
gen x = _n
gen m_hdl_u = m_hdl + 1.96*se_hdl
gen m_hdl_l = m_hdl - 1.96*se_hdl
twoway (scatter m_hdl yrsbsl if grp==1) ///
(rcap m_hdl_u m_hdl_l yrsbsl if grp==1) ///
(line m_hdl yrsbsl if grp==1) ///
(scatter m_hdl yrsbsl if grp==0) ///
(rcap m_hdl_u m_hdl_l yrsbsl if grp==0) ///
(line m_hdl yrsbsl if grp==0)
ytitle (Mean HDL-cholesterol over time)
I want to manually add an asterix above each time-point to show if means were significantly different between groups at each timepoint. Is there a way to add those asterix? Better yet, is there a way for stata to auto calculate whether or not means are statistically different at each time-point and add and asterix automatically?
Thanks
Comment