Announcement

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

  • question to stset _t and _t0

    Hi guys, I am new to Stata, just wondering how stata calculates the value of _t and _t0.

    Many thx

  • #2
    Ying:
    welcome to this forum.
    I do hope that the following toy-example can give you some guidance:
    Code:
    . set obs 2
    number of observations (_N) was 0, now 2
    
    . g id=_n
    
    . g time_in=2
    
    . g time_out=4
    
    . g failure=1 in 1
    (1 missing value generated)
    
    . replace failure=0 if failure==.
    (1 real change made)
    
    . g study_time= time_out- time_in
    
    . stset study_time, failure(failure)
    
         failure event:  failure != 0 & failure < .
    obs. time interval:  (0, study_time]
     exit on or before:  failure
    
    ------------------------------------------------------------------------------
              2  total observations
              0  exclusions
    ------------------------------------------------------------------------------
              2  observations remaining, representing
              1  failure in single-record/single-failure data
              4  total analysis time at risk and under observation
                                                    at risk from t =         0
                                         earliest observed entry t =         0
                                              last observed exit t =         2
    
    . list
    
         +--------------------------------------------------------------------+
         | id   time_in   time_out   failure   study_~e   _st   _d   _t   _t0 |
         |--------------------------------------------------------------------|
      1. |  1         2          4         1          2     1    1    2     0 |
      2. |  2         2          4         0          2     1    0    2     0 |
         +--------------------------------------------------------------------+
    
    .
    For more details, I would recommend you to get yourself familiar with the -st- entries in Stata .pds manual.
    Last but absolutely not least, the valuable textbook https://www.stata.com/bookstore/surv...-introduction/ highly deserves to be included in the toolkit of Statalisters dealing with survival analysis.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      So appreciated Carlo

      Comment

      Working...
      X