Announcement

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

  • Creating graphs showing survival curves with confidence intervals on multiple record data

    Hi Statalist.

    Is there a way to show survival curves with confidence intervals for multiple-record data? I have been using -stcurve- for my graphing but there is not an option to display confidence intervals to survival functions. On this, the -stcurve- documentation states
    See Cefalu (2011) for a Stata command to plot the survivor or cumulative hazard function with pointwise confidence intervals.
    When I tried to use -survci- Stata provided this response:
    Code:
    . survci
    survci may not be used with multiple-record data
    r(498);
    Help appreciated.


  • #2
    stpm2 (from SSC)

    Comment


    • #3
      Thank you Paul Dickman. I read over the help file for this, while I found it complicated (I did not understand the concept of "knots" and what needed to be entered there.. I did run a basic regression and found it provided very similar hazard ratios to that when using -stcox-, but I didn't see any guidance/examples on creating the survival curves with CIs. If you know of any links with some basic examples, could you please post? Kind regards, Chris

      Comment


      • #4
        Here's an example of plotting survival curves with CIs
        https://pclambert.net/software/stpm2/stpm2_timevar/

        This tutorial shows how to produce standardised survival curves with CIs. This is awesome!
        https://pclambert.net/software/stand...ized_survival/

        This covers the basics
        https://pclambert.net/software/stpm2/comparewithcox/

        Comment


        • #5
          I would like to produce a graph displaying survival curves showing the mean survival with 95% confidence intervals for categories of a variable. Here's an example of what I want to achieve using sts graph
          Code:
          sts graph, survival by(relig) ci name(relig2, replace) ///
          graphregion(color(white) icolor(white)) plotregion(style(none) color(white) icolor(white)) ///
          plot2opts(lcolor(maroon)) plot4opts(lcolor(orange_red)) ///  
          title("Mean with 95% Confidence Intervals", size(medsmall)) ///
          ytitle("Survival", size(small)) ylabel(.84(.02)1.0 , angle(horizontal)) yscale(noline) ylabel(, labsize(small)) ///
          xlabel(, labsize(vsmall)) xmlabel(##5) xtitle("Duration (in Years)", size(small)) ///
          legend(region(lstyle(none)) size(small) row(1) pos(6) rowgap(1) span ///
          order(8 "group4" 6 "group3" 4 "group2" 2 "group1"))
          which provided the following graph, but it lacks clarity with regard to the mean and their 95% CIs.
          Click image for larger version

Name:	survival_ci.png
Views:	1
Size:	12.0 KB
ID:	1640647
          I installed stmp2 (from SSC) and after reading the help file, I ran the following
          Code:
          stset wave, failure(end==1) id(couple) origin(begin==1) exit(time .)
          stpm2 rel, scale(hazard) df(5) eform
          I have not worked out how to use -predict- to my variable with 4-categories to create the confidence intervals. I tried the following with variations
          Code:
          predict relsurv, at(rel(1 2 3 4)) survival ci timevar(wave)
          though Stata reported errors, e.g.,"2 invalid name". Some help with that and I should then be able to graph using something like:
          Code:
          twoway (rarea relsurv_lci relsurv_uci wave) ///
          (line relsurv wave) ///
          , legend(order(1 "rel1" 2 "rel2" 3 "rel3" 4 "rel4") ring(0) cols(1) pos(1)) ///
          ylabel(, angle(h) format(%3.1f)) ytitle("") xtitle("") name(ci, replace)
          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float couple byte(rel wave begin end)
           4 1 1 1 0
           4 1 2 0 0
           4 1 3 0 0
           4 1 4 0 0
           4 1 5 0 0
           4 1 6 0 0
           4 1 7 0 0
           4 1 8 0 1
           6 2  1 1 0
           6 2  2 0 0
           6 2  3 0 0
           6 2  4 0 0
           6 2  5 0 0
           6 2  6 0 0
           6 2  7 0 1
           7 4  1 1 0
           7 4  2 0 0
           7 4  3 0 0
           7 4  4 0 0
           7 4  5 0 0
           7 4  6 0 0
           7 4  7 0 0
           9 4  1 1 0
           9 4  2 0 0
           9 4  3 0 0
           9 4  4 0 0
           9 4  5 0 0
           9 4  6 0 0
           9 4  7 0 0
           9 4  8 0 0
           9 4  9 0 0
          13 4  1 1 0
          13 4  2 0 0
          13 4  3 0 0
          13 4  4 0 0
          13 4  5 0 0
          13 4  6 0 0
          13 4  7 0 0
          13 4  8 0 0
          13 4  9 0 0
          end
          Stata 15.1. Using panel data.
          Last edited by Chris Boulis; 13 Dec 2021, 04:12.

          Comment

          Working...
          X