Announcement

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

  • Kaplan Meier curve

    dear all,

    Is it possible to make a small colored diamond for each event /failure in a Kaplan Meier curve on Stata 17?

    stset weeks, fail(med_stop)
    sts graph if diagnosis==1, risktable ytitle (Persistent rate) xtitle (Weeks since first med) title ("Fig 1A. Kaplan-Meier curve for XYZ", size(8pt) color(black))
    Last edited by Nishan Lamichhane; 10 Jan 2023, 07:26. Reason: survival analysis

  • #2
    If you have varying number of failures at different points in time, then it may be more informative to report the number of failures rather than just indicating failures. For some studies, e.g., dieting, you expect more failures closer to the beginning than the end as those who persist at the beginning are less likely to give up with the passage of time. Here is a way using the -addplot()- option.

    Code:
    webuse drugtr, clear
    stset studytime, failure(died)
    set scheme s1mono
    *INDICATORS (MARKERS)
    sts graph, addplot(scatter _d _t if _d==1, msy(d)) leg(off)
    
    *NUMBER OF FAILURES
    bys _t: egen howmany= total(_d)
    sts graph, addplot(scatter _d _t if _d==1, msy(none) mlab(howmany) mlabpos(0)) leg(off)
    Click image for larger version

Name:	Graph1.png
Views:	1
Size:	27.5 KB
ID:	1696683

    Click image for larger version

Name:	Graph2.png
Views:	1
Size:	26.0 KB
ID:	1696684

    Last edited by Andrew Musau; 10 Jan 2023, 10:12.

    Comment


    • #3
      Thank you Andrew. It helped a lot.

      Comment

      Working...
      X