Announcement

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

  • Standard deviation lines for xtline graph

    I am wondering how to add standard deviation lines to a timeseries graph I made (xtline)

    I calculated the standard deviation already, just unsure of how to plot as upper and lower error bars to the main value of interest.

    Code:
    collapse (mean) adhpc = adhpc (sd) sdadhpc=adhpc, by(subject1 visitdate1)
    
    xtset subject1 visitdate1
    
    xtline adhpc sdadhpc, legend(off)

  • #2
    I'm also interested in how to add a mean trend line if that is possible in stata.

    I think I figured out how to do this using tssmooth
    There is a YouTube video: https://www.youtube.com/watch?v=KRhroFkSviw
    Last edited by Emily Huang; 14 Nov 2020, 14:17.

    Comment


    • #3
      I often use 'lgraph' program written by Timothy Mak avoiding 'collapse':

      Code:
      //Install lgraph program
      ssc install lgraph
      
      lgraph adhph visitdat1, err(sd)
      Roman

      Comment

      Working...
      X