Announcement

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

  • Show stci output in hours

    Hello,

    I am performing some survival analyses. When performing stci, the output is given in milliseconds, thus rendering rather large (unreadable) values:
    Code:
    . stci, by(rand)
    
             Failure _d: censored
       Analysis time _t: (exitdatetime-origin)
                 Origin: time firstdosedatetime
      Enter on or after: time firstdosedatetime
    
                 | Number of
    rand         |  subjects         50%      Std. err.    [95% conf. interval]
    -------------+-------------------------------------------------------------
        Drug1 |        16    1.15e+08      168183.1      5.0e+07    2.7e+08
         Drug2 |        17    1.44e+08      4.80e+07      1.2e+08    2.0e+08
    -------------+-------------------------------------------------------------
           Total |        33    1.19e+08      3.63e+07      1.2e+08    2.0e+08
    
    .
    How can I have the input given in hours? I could not find out how to apply the hours() command in this context.

    Thank You so much,
    Dorothea
    Last edited by Dorothea Ekoka Mbassi; 23 May 2023, 15:18.

  • #2
    I think you need to rescale the time variables.


    Code:
    stci, by(rand)
    
    *RESCALED
    preserve
    foreach var of varlist t t0 _t _t0{
        replace `var'=`var'/(1000*60*60)
    }
    stci, by(rand)
    restore

    Comment


    • #3
      Thank You Andrew,
      this looks useful but does not work yet, it says invalid syntax - Can You spot the error?
      What varlist should it be, that is, from what variables does stci calculate its output?
      The basis for my analysis was
      Code:
      stset exitdatetime, failure(censored) enter(firstdosedatetime) origin(firstdosedatetime)
      Thank You

      Comment


      • #4
        Your time variable is named "exitdatetime" and Stata creates the variables "_t" and "_t0". So without changing the stsettings,

        Code:
        stci, by(rand)
        should give you your current results and following this,

        Code:
        preserve
        foreach var of varlist exitdatetime _t _t0{
            replace `var'= `var'/(1000*60*60)
        }
        stci, by(rand)
        restore
        should give you the rescaled results. Otherwise provide a reproducible example.

        Comment


        • #5
          There is a direct way that avoids the workaround in #2 - see highlighted.

          Code:
          stset exitdatetime, failure(censored) enter(firstdosedatetime) origin(firstdosedatetime) scale(`=1000*60*60')
          The option is explained in

          Code:
          help stset

          Comment


          • #6
            Both work wonderfully, You've been so helpful once again!

            Comment

            Working...
            X