5

How one can create a logrank test for trend and does it differ from normal logrank test? Any suggestions or literature? Maybe some R examples and functions?

Marcin Kosiński
  • 819
  • 3
  • 12
  • 25
  • Could you elaborate your hypothesis, e.g. by a formula? – Horst Grünbusch Aug 20 '14 at 10:04
  • 3
    To add to that it is important to state what type of variable you wish to associate with time-to-event. If it is an unordered categorical variable then the logrank test as it was originally proposed is a decent choice. There is no reason not to use its generalization the Cox PH model though. And don't fall for the commonly used "tests for trend" in which a continuous variable is split into quantile groups and the quantile group integers are treated as linear in the log hazard. This is a poorly fitting model if there ever was one. – Frank Harrell Jun 20 '15 at 18:44
  • Thanks @FrankHarrell, I will remember not to do this :) – Marcin Kosiński Jun 21 '15 at 13:15

2 Answers2

3

Try comp from survMisc package. It extends the survival package. It counts statistic and p-value for logrank test, as well as for Gehan-Breslow, Tarone-Ware, Peto-Peto and Fleming-Harrington tests and tests for trend (for all of the above mentioned). The example taken from the manual is the following:

data(larynx, package="KMsurv")
s4 <- survfit(Surv(time, delta) ~ stage, data=larynx)
comp(s4)
comp(s4)$tests$trendTests # outputs only the results for trend tests

If you compare the results with

survdiff(Surv(time, delta) ~ stage, data=larynx)

you get the same result for 'traditional' logrank test (not the trend test).

potockan
  • 231
  • 2
  • 5
2

Your question is not very clear, so not sure if this is what you are looking for. To test the proportional hazards assumption you can use the Grambsch-Therneau test on Schoenfeld residuals of the proportional hazards model. This essentially tests the slope of (scaled) residuals as a function of follow-up time.

Marc Claesen
  • 17,399
  • 1
  • 49
  • 70