Announcement

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

  • Obtaining Survival Point-estimates using stcox and streg

    Hello,

    I am using Stata 14.1. I have a survival analysis and I am trying to use a cox proportional hazards model to estimate the time to death after transplant for rld_tx_type = 1, 2 and 3, in a model with multiple covariates. Using stcox I can obtain hazard ratios, but I would like to obtain adjusted point estimates for survival at specific time points like 365 days, 1095 days, 1825 days.

    Using streg and weibull distribution parametric survival model followed by the margins command, I can obtain point estimates for survival at 365 days.

    I have read numerous similar entries on this topic, that discuss the inability to estimate baseline hazards using stcox b/c cox regression doesnt estimate the baseline hazard. Is this why I am unable to obtain point estimates using stcox?


    *Code


    stset gtime, failure(outcome)

    streg i.rld_tx_type gender_group ecmo_trr ventilator_trr i.blood_type i.year i.Ethnic bmi_analysis pTLC_ratio_copd end_match_las age_don gender_mismatch ischtime end_o2 i.lung_preference, vce(robust) dist(weibull)

    streg, coeflegend

    margins, expression(exp(-exp(predict(xb))*1825^exp(_b[ln_p:_cons]))) at(rld_tx_type=(1 2 3))



    *Output

    . stset gtime, failure(outcome)

    failure event: outcome != 0 & outcome < .
    obs. time interval: (0, gtime]
    exit on or before: failure

    ------------------------------------------------------------------------------
    5055 total observations
    13 observations end on or before enter()
    ------------------------------------------------------------------------------
    5042 observations remaining, representing
    2212 failures in single-record/single-failure data
    6507620 total analysis time at risk and under observation
    at risk from t = 0
    earliest observed entry t = 0
    last observed exit t = 4412

    .
    . streg i.rld_tx_type gender_group ecmo_trr ventilator_trr i.blood_type i.year i.Ethnic bmi_analysis pTLC_ratio_copd end_match_las age_don
    > gender_mismatch ischtime end_o2 i.lung_preference, vce(robust) dist(weibull)

    failure _d: outcome
    analysis time _t: gtime

    Fitting constant-only model:

    Iteration 0: log pseudolikelihood = -5568.0139
    Iteration 1: log pseudolikelihood = -5556.817
    Iteration 2: log pseudolikelihood = -5556.8074
    Iteration 3: log pseudolikelihood = -5556.8074

    Fitting full model:

    Iteration 0: log pseudolikelihood = -5556.8074
    Iteration 1: log pseudolikelihood = -5507.4874
    Iteration 2: log pseudolikelihood = -5506.2359
    Iteration 3: log pseudolikelihood = -5506.2337
    Iteration 4: log pseudolikelihood = -5506.2337

    Weibull regression -- log relative-hazard form

    No. of subjects = 4,866 Number of obs = 4,866
    No. of failures = 2,117
    Time at risk = 6193954
    Wald chi2(36) = 105.86
    Log pseudolikelihood = -5506.2337 Prob > chi2 = 0.0000

    ---------------------------------------------------------------------------------
    | Robust
    _t | Haz. Ratio Std. Err. z P>|z| [95% Conf. Interval]
    ----------------+----------------------------------------------------------------
    rld_tx_type |
    2 | .8249158 .0641938 -2.47 0.013 .7082234 .9608354
    3 | .7857402 .062952 -3.01 0.003 .6715562 .9193388
    |
    gender_group | 1.094763 .0534039 1.86 0.063 .9949418 1.2046
    ecmo_trr | 1.587534 .9326214 0.79 0.431 .501963 5.020819
    ventilator_trr | 1.325516 .1665057 2.24 0.025 1.036241 1.695545
    |
    blood_type |
    2 | .9575172 .0441988 -0.94 0.347 .8746923 1.048185
    3 | .9455973 .0703752 -0.75 0.452 .8172527 1.094098
    4 | .9209833 .0991832 -0.76 0.445 .7457333 1.137418
    |
    year_tx |
    2 | .8792394 .1061766 -1.07 0.287 .6939312 1.114032
    3 | .9375805 .1130025 -0.53 0.593 .7403157 1.187409
    4 | .8853886 .1082717 -1.00 0.320 .6966953 1.125188
    5 | .817168 .0988432 -1.67 0.095 .6446908 1.035789
    6 | .7776473 .0963679 -2.03 0.042 .6099578 .991438
    7 | .8771987 .1082622 -1.06 0.288 .6887226 1.117253
    8 | .7459922 .0964708 -2.27 0.023 .5789726 .961193
    9 | .7436866 .1000223 -2.20 0.028 .5713568 .9679937
    10 | .6911968 .1026914 -2.49 0.013 .5165809 .9248367
    11 | .944747 .1380387 -0.39 0.697 .7094878 1.258016
    12 | .7908836 .1392182 -1.33 0.183 .5601143 1.116731
    13 | .4194482 .2500005 -1.46 0.145 .1304197 1.349004
    |
    Ethnic |
    2 | 1.044576 .0912809 0.50 0.618 .8801515 1.239718
    4 | 1.11143 .2007295 0.58 0.559 .7801019 1.583482
    5 | .9110327 .2200833 -0.39 0.700 .5674197 1.462728
    |
    bmi_analysis | 1.010092 .0055142 1.84 0.066 .9993424 1.020958
    pTLC_ratio_copd | .8998795 .0441061 -2.15 0.031 .8174554 .9906143
    end_match_las | .9960659 .0054117 -0.73 0.468 .9855155 1.006729
    age_don | 1.000985 .0015336 0.64 0.521 .9979834 1.003995
    gender_mismatch | 1.16013 .0621598 2.77 0.006 1.044477 1.288588
    ischtime | .9901301 .0149002 -0.66 0.510 .9613527 1.019769
    end_o2 | 1.025314 .0115466 2.22 0.026 1.002931 1.048197
    |
    lung_preference |
    2 | .910501 .1291987 -0.66 0.509 .6894396 1.202443
    3 | .9074591 .0921592 -0.96 0.339 .7436717 1.107319
    4 | .847192 .0941981 -1.49 0.136 .6812992 1.053479
    5 | 1.095501 .109549 0.91 0.362 .9005204 1.332699
    6 | .9505574 .1139962 -0.42 0.672 .7514455 1.202428
    7 | .9216207 .1356492 -0.55 0.579 .6906654 1.229806
    |
    _cons | .0008421 .0002809 -21.23 0.000 .000438 .001619
    ----------------+----------------------------------------------------------------
    /ln_p | -.0939497 .0231057 -4.07 0.000 -.1392361 -.0486633
    ----------------+----------------------------------------------------------------
    p | .9103286 .0210338 .8700226 .9525018
    1/p | 1.098504 .0253817 1.049867 1.149395
    ---------------------------------------------------------------------------------

    .
    . streg, coeflegend

    Weibull regression -- log relative-hazard form

    No. of subjects = 4,866 Number of obs = 4,866
    No. of failures = 2,117
    Time at risk = 6193954
    Wald chi2(36) = 105.86
    Log pseudolikelihood = -5506.2337 Prob > chi2 = 0.0000

    ---------------------------------------------------------------------------------
    _t | Coef. Legend
    ----------------+----------------------------------------------------------------
    rld_tx_type |
    2 | -.1924739 _b[_t:2.rld_tx_type]
    3 | -.2411291 _b[_t:3.rld_tx_type]
    |
    gender_group | .0905383 _b[_t:gender_group]
    ecmo_trr | .4621821 _b[_t:ecmo_trr]
    ventilator_trr | .2818021 _b[_t:ventilator_trr]
    |
    blood_type |
    2 | -.0434116 _b[_t:2.blood_type]
    3 | -.0559385 _b[_t:3.blood_type]
    4 | -.0823133 _b[_t:4.blood_type]
    |
    year_tx |
    2 | -.1286981 _b[_t:2.year_tx]
    3 | -.0644526 _b[_t:3.year_tx]
    4 | -.1217286 _b[_t:4.year_tx]
    5 | -.2019106 _b[_t:5.year_tx]
    6 | -.2514822 _b[_t:6.year_tx]
    7 | -.1310217 _b[_t:7.year_tx]
    8 | -.2930401 _b[_t:8.year_tx]
    9 | -.2961355 _b[_t:9.year_tx]
    10 | -.3693308 _b[_t:10.year_tx]
    11 | -.0568382 _b[_t:11.year_tx]
    12 | -.2346045 _b[_t:12.year_tx]
    13 | -.8688152 _b[_t:13.year_tx]
    |
    Ethnic |
    2 | .0436113 _b[_t:2.Ethnic]
    4 | .1056479 _b[_t:4.Ethnic]
    5 | -.0931765 _b[_t:5.Ethnic]
    |
    bmi_analysis | .0100419 _b[_t:bmi_analysis]
    pTLC_ratio_copd | -.1054945 _b[_t:pTLC_ratio_copd]
    end_match_las | -.0039418 _b[_t:end_match_las]
    age_don | .0009842 _b[_t:age_don]
    gender_mismatch | .1485317 _b[_t:gender_mismatch]
    ischtime | -.0099189 _b[_t:ischtime]
    end_o2 | .0249992 _b[_t:end_o2]
    |
    lung_preference |
    2 | -.0937603 _b[_t:2.lung_preference]
    3 | -.0971068 _b[_t:3.lung_preference]
    4 | -.165828 _b[_t:4.lung_preference]
    5 | .091212 _b[_t:5.lung_preference]
    6 | -.0507067 _b[_t:6.lung_preference]
    7 | -.0816215 _b[_t:7.lung_preference]
    |
    _cons | -7.079553 _b[_t:_cons]
    ----------------+----------------------------------------------------------------
    /ln_p | -.0939497 _b[ln_p:_cons]
    ----------------+----------------------------------------------------------------
    p | .9103286
    1/p | 1.098504
    ---------------------------------------------------------------------------------

    .
    . margins, expression(exp(-exp(predict(xb))*1825^exp(_b[ln_p:_cons]))) at(rld_tx_type=(1 2 3))

    Predictive margins Number of obs = 4,866
    Model VCE : Robust

    Expression : exp(-exp(predict(xb))*1825^exp(_b[ln_p:_cons]))

    1._at : rld_tx_type = 1

    2._at : rld_tx_type = 2

    3._at : rld_tx_type = 3

    ------------------------------------------------------------------------------
    | Delta-method
    | Margin Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    _at |
    1 | .4857455 .0222814 21.80 0.000 .4420748 .5294162
    2 | .5503463 .0220442 24.97 0.000 .5071405 .593552
    3 | .5659892 .0123369 45.88 0.000 .5418094 .590169
    ------------------------------------------------------------------------------

    Thanks,

    Luke

  • #2
    Matthew Cefalu and Yulia Marchenko's command survci will create predicted survival curves and confidence intervals after stcox.
    Code:
    findit survci
    Please make your future posts more readable by putting code and results between CODE delimiters, as requested in FAQ 12. The delimiters are [CODE] and [/CODE].
    Last edited by Steve Samuels; 08 Aug 2018, 07:49.
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      Thank you. This works well. The survci produces adjusted survival curves with confidence intervals. I used outfile option, which saved the output into a new stata file and you can obtain the survival estimate and confidence interval for any specific time point.

      Code:
      survci, outfile(failonly)
      Thanks again.

      Comment

      Working...
      X