Announcement

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

  • Delayed entry due to missing X values in survival analysis?

    Dear Statalisters,

    I observe each subject’s event history since t=0 (when the subject is at risk of failure). However, I don’t have values for the explanatory variable X for the entire period. For example,

    ID begin end fail X
    1 0 1 0 .
    1 1 2 0 .
    1 2 3 0 10
    1 3 4 1 15

    Is this considered “delayed entry” in the survival analysis? Is it proper to use the following stset command?
    stset end, id(id) fail(fail) enter (x !=.)

    Thanks.

    Bo

  • #2
    Stat will ignore the missing x's, but in case there gaps, use the time0() option.
    Code:
    clear
    input id  begin end fail x
    1 0 1 0 .
    1 1 2 0 4
    1 3 4 1 15
    2 0 1 0  .
    2 1 2 0 .
    2 2 3 0 16
    2 3 4 0 .
    2 4 5 1 5
    3 0 10 0 14
    end
    list, sepby(id)
    stset end ,  fail(fail) time0(begin) id(id)
    order id _t0 _t
    list, sepby(id)
    /*
      +----------------------------------------------------+
         | id   _t0   _t   begin   end   fail    x   _st   _d |
         |----------------------------------------------------|
      1. |  1     0    1       0     1      0    .     1    0 |
      2. |  1     1    2       1     2      0    4     1    0 |
      3. |  1     3    4       3     4      1   15     1    1 |
         |----------------------------------------------------|
      4. |  2     0    1       0     1      0    .     1    0 |
      5. |  2     1    2       1     2      0    .     1    0 |
      6. |  2     2    3       2     3      0   16     1    0 |
      7. |  2     3    4       3     4      0    .     1    0 |
      8. |  2     4    5       4     5      1    5     1    1 |
         |----------------------------------------------------|
      9. |  3     0   10       0    10      0   14     1    0 |
         +----------------------------------------------------+
    */
    stcox x
    stcox x if x!=.  //same result
    /*
    . stcox x if x!=.
    
             failure _d:  fail
       analysis time _t:  end
                     id:  id
    
    Iteration 0:   log likelihood = -1.3862944
    Iteration 1:   log likelihood = -.95478346
    Iteration 2:   log likelihood = -.92165942
    Iteration 3:   log likelihood = -.91941357
    Iteration 4:   log likelihood = -.91939296
    Refining estimates:
    Iteration 0:   log likelihood = -.91939296
    
    Cox regression -- no ties
    
    No. of subjects =            3                  Number of obs    =           5
    No. of failures =            2
    Time at risk    =           14
                                                    LR chi2(1)       =        0.93
    Log likelihood  =   -.91939296                  Prob > chi2      =      0.3339
    
    ------------------------------------------------------------------------------
              _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
               x |   .7419454   .3291334    -0.67   0.501      .311008    1.769996
    ------------------------------------------------------------------------------
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      Thanks a lot, Steve. Always appreciate it.

      Comment

      Working...
      X