Announcement

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

  • KM and gompertz survival function graphs

    Hi,

    I am doing some economic evaluation and would like to plot the KM survival curve and the survival curve from a Gompertz model on the same chart.
    I have started with this:

    eval_data.dta

    Code:
    use eval_data.dta, clear
    stset date, id(ID) time0(date0) origin(time date) failure(event==1)
    local dbn "gom"
    streg baseline_age i.sex i.treatment, dist(`dbn') //nohr
    stcurve, survival ylabels(0 0.5 1) ///
        xscale(range(365 1826)) xlabel(/*0 "2023" */365 "2024" 731 "2025" 1096 "2026" 1461 "2027" 1826 "2028") ///
        outfile("`dbn'_values_1.dta", replace) name("`dbn'_surv_1")
    
    sts graph, surv name("KM") outfile("km_values.dta", replace)  // KM curve
    But I would like them on the same chart. How can I do this?

    Grateful for any help. Thanks in advance.


    Attached Files
    Last edited by Jane Fry; 06 Feb 2024, 04:52.

  • #2
    You need to work with the files that you created in the -outfile()- options of -stcurve- and -sts graph-. You need to harmonize the names they gave to analysis time if those are different (though I think both are _t) and make sure they have distinct names for the values of the survival function. Then merge them on _t and use -graph twoway connect-.

    Comment


    • #3
      Thanks Clyde Schechter . That worked nicely!

      Comment

      Working...
      X