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
Related Posts with Generating KM curves in stratified analysis with time varying covariate
Panel data Mediation modelDear all, I have a dataset with panel data from 2015-2018 My independent variable is categorical an…
Missing Values GeneratedHello, I have panel data for 820 companies for 19 years i.e. 15580 observations (820*). I ran the fo…
WTP space using effect code and estimated via the command of mixlogitwtpDear Experts, I am doing a DCE study and use the command of mixlogitwtp to estimate WTP space. All …
Manually creating/editing/storing estimates for esttabI am running a series of loops that try out all combinations of Stata's new lasso functions dsregres…
Question about the command fuzzydidDear all, When I run the codes of fuzzydid help file,but I get an error.I don't know why. Code: …
Subscribe to:
Post Comments (Atom)
0 Response to Generating KM curves in stratified analysis with time varying covariate
Post a Comment