Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Two-way scatter plot statistical significance symbol

    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

  • #2
    You are first calculating crude confidence intervals for your means for separate groups and separate years. ("Crude" means that 1.96 is a rough multiplier for large sample sizes with conditional normal distribution.)

    Those won't convey differences between groups. You need to run an appropriate test or tests. If you have two groups and several years, a minimal analysis looks at variations between groups and over years, or perhaps such an analysis is repeated for each year.

    I don't know what your groups are (because you don't say), or whether HDL-cholesterol is best looked at on a transformed scale (because I am not a medic or medical statistician). But a rough analogy of what I think you are doing would be trying to say whether male and female mean heights are different at some significance level just from confidence intervals for each, but without doing a suitable t test.

    Comment

    Working...
    X