Announcement

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

  • Multiple KM curves for overall & disease related mortality?

    Dear Users,
    Seems to be basic... I'm struggling to create a KM survival graph that has multiple curves on it. I've found an option to have multiple curves according to a grouping variable, but how can I create two curves that are associated to the very same group of patients, but based on different variables: overall mortality and disease-related mortality? Thx for your help.

  • #2
    Csaba,

    If you are using Stata (which I presume you are), you might be better off using -twoway- line plots generating your survival instead of sts graph. I sense you will have to do two separate stset statements. This below was me adding a flexible parametric curve to the the K-M plot generated by sts graph looking at OS at 5 years after diagnosis for both. You are welcome to use bits and pieces of the code depending on your specific use case. If you share your de-identified data via -dataex- , you might get more help in the forum for your specific use case.


    Code:
    local x rt1chembtk
    keep if f17==1
    
    // Run flexible parametric analysis and KM and save meansurvival
    *--------------------------------------------------------------------------------------
    cap drop temptime 
    stpm2 i.`x', df(4) eform scale(hazard)
    cap drop s0* 
    cap drop s1* 
    range temptime 0 5 1000 
    /*predict the survival for both therapies*/
    forvalues i = 0/1 {
        predict s`i', meansurv at(`x' `i') timevar(temptime) ci
    }
    list s0 s1 in 1000
    sts graph, by(rt1chembtk) ///
                        risktable(0(1)5 , size(small) order(1 "Frontline NA" 2 "Frontline chemo only")) ///
                        plot1opts(lcol(navy%22)) plot2opts(lcol(cranberry%21))                             ///
                        addplot(line s0 s1 temptime, sort color(navy%88 cranberry%85) legend(1 "FPM" 2 "FPM2"))                     ///
                        ylab(0 "0" .25 "25" .5 "50" .75 "75" 1 "100")                                     ///
                        ytitle("Survival probability (KM)/ Predicted OS (FPM)", size(small))             ///
                        xtitle("Time since transformation (years)", size(small))                         ///
                        title("NA in del(17p) positive subset") ///
                        legend(off) ///
                        subtitle("Frontline RT therapy (P = 0.085 by FPM and Log-rank test)") ///
                        text (.6 3 "BTKi/BCL2i (OS60: {bf: 47%})") 
    
    graph export ".\Manuscripts CORTI\Fig_kmfpm_OS60_`x'_sub_f17_1.png", width (2000) height(1600) replace as(png)
    
    drop s0* s1* temptime _rc* _d_*   
    This gives:
    Click image for larger version

Name:	Fig_kmfpm_OS60_rt1chembtk_sub_f17_1.png
Views:	1
Size:	188.1 KB
ID:	1727360

    Comment

    Working...
    X