Announcement

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

  • Generating KM curves in stratified analysis with time varying covariate

    I am trying to generate KM curves in a survival analysis that is stratified by matched pairs and also adjusted for a time varying covariate. In short, stcurve doesn't seem to be an option and I cannot figure out how to get sts graph to work accurately (details below).

    Data: The data are set up with multiple observations per individual. There are two groups of subjects: those who ever used treatment (_treated==1) and those who never used treatment (_treated==0). The data are organized by visit number (vnum) and subjects are matched by several variables (not shown). On the day of starting treatment (niv_rx==1) the users are matched to a never user. The survival (match_time) since the date of matching (match_visit==1) is then compared to see if treatment has an effect on survival.

    In addition, I have a time-varying covariate (niv_hrs) which indicates the number of hours per day that the subject was using therapy.

    An example of two matched pairs is below

    | subject_id pair vnum match_visit match_time _treated niv_rx niv_hrs
    |--------------------------------------------------------------------------------------------------
    | 116572 3191 1 0 -5.6 Untreated 0 0 |
    | 116572 3191 2 0 -3.5 Untreated 0 0 |
    | 116572 3191 3 1 0 Untreated 0 0 |
    | 116572 3191 4 0 3.5 Untreated 0 0 |
    | 116572 3191 5 0 5.133333 Untreated 0 0 |
    |-----------------------------------------------------------------------------------|
    | 116572 3191 6 0 7.933333 Untreated 0 0 |
    | 116572 3191 7 0 8.633333 Untreated 0 0 |
    | 116572 3191 8 0 10.73333 Untreated 0 0 |
    | 116572 3191 9 0 13.53333 Untreated 0 0 |
    | 116572 3191 10 0 16.1 Untreated 0 0 |
    |-----------------------------------------------------------------------------------|
    | 116572 3191 11 0 22.13333 Untreated 0 0 |
    | 109006 3191 1 0 -5.6 Treated 0 0 |
    | 109006 3191 2 0 -2.566667 Treated 0 0 |
    | 109006 3191 3 1 0 Treated 1 4 |
    | 109006 3191 4 0 3.5 Treated 1 4 |
    |-----------------------------------------------------------------------------------|
    | 116686 3199 1 0 -5.7 Untreated 0 0 |
    | 116686 3199 2 0 -.8 Untreated 0 0 |
    | 116686 3199 3 1 0 Untreated 0 0 |
    | 120295 3199 1 0 -6.066667 Treated 0 0 |
    | 120295 3199 2 0 -2.333333 Treated 0 0 |
    |-----------------------------------------------------------------------------------|
    | 120295 3199 3 1 0 Treated 1 0 |
    | 120295 3199 4 0 3.266667 Treated 1 8 |
    | 120295 3199 5 0 6.533333 Treated 1 8 |
    | 120295 3199 6 0 19.86667 Treated 1 8 |





    The code and output for my survival analysis is as follows, looking at the survival by receiving therapy, stratified by pair, with niv_hrs as a time-varying covariate. You will see that there is a trend towards a benefit to niv_rx:

    stcox niv_rx, strata(pair) tvc(niv_hrs) vce(robust)

    ------------------------------------------------------------------------------
    | Robust
    _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    main |
    niv_rx | .7963576 .096347 -1.88 0.060 .6282403 1.009463
    -------------+----------------------------------------------------------------
    tvc |
    bipaphours | 1.00039 .0011905 0.33 0.743 .9980599 1.002727
    ------------------------------------------------------------------------------
    Stratified by pair



    However, I cannot do stcurve after this analysis as stcurve is not compatible with stratified analyses. Sts graph does not have an obvious way to both stratify by pairs and adjust for the time-varying covariate. Is there another way to accurately represent this survival curve? Such as through graphing a twoway line to do this with post-estimation commands?

    Thank you so much in advance for your time and effort!

    JT
Working...
X