Announcement

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

  • (Survival Analysis) How to perform a logrank test on two survival functions adjusted for some values?

    Hello guys. I have a table similar to this:
    id power category time
    1 35 A 8
    2 50 A 34
    3 75 B 17
    4 50 A 11
    5 60 B 50
    After setting my survival data with:

    sts time

    I want to compare the 2 survival functions of the items of category A and B, adjusted for Power = 45

    I can do it grafically, typing:

    generate power45 = power–45

    sts graph, strata(category) adjustfor(power45)

    Or, as an alternative:

    sts graph, by(category) adjustfor(power45)

    My question now is: how can I perform a test on the equality of these 2 adjusted survival functions for know if they are statistically equal or not?
    I can't figure it out, I'm pretty sure sts test can't help...

    Thank you
    Last edited by Dan Smith; 24 Aug 2014, 18:23.

  • #2
    See sts test, which has both logrank and strata() options.
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      I tried:

      sts test category, strata(power45) logrank

      but it provides exactly the same output of

      sts test category, strata(power) logrank

      Is that what you mean Steve?

      Comment


      • #4
        Sorry- I overlooked your desire for an adjusted analysis. To do that, use stcox. The score test for a single indicator (two-group) variable is equivalent to the log rank test, but the Wald test for the indicator (Z statistic) tests the same hypothesis and is close. To adjust for power45, add it as a covariate. I recommend the option for robust standard errors. The sts graph commands should have alerted you to possibly non-proportional hazards in the two categories, and you can model this in stcox with the tvc and texp() options--see page 129 of the Stata 13. Manual. To really see what's going on, don't settle for a linear term in power45; use fp to detect a non-linear effect on the log hazard. Also check for interactions interactions of category and power45.

        Code snippets


        Code:
         stcox  category power45, robust
        or

        Code:
        stcox  category power45, robust tvc(category) texp(log(_t))
        test [main]category [tvc]category texp(log(_t))
        Last edited by Steve Samuels; 24 Aug 2014, 20:36.
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment


        • #5
          Correction to the test statement for assessing simultaneously the main and tvc interaction affects of category.

          Code:
          stcox  category power45, robust tvc(category) texp(log(_t))
          test [main]category [tvc]category
          I apologize for the error.
          Last edited by Steve Samuels; 25 Aug 2014, 15:30.
          Steve Samuels
          Statistical Consulting
          [email protected]

          Stata 14.2

          Comment

          Working...
          X