Logrank test for trend (proportional hazards)

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?

• Could you elaborate your hypothesis, e.g. by a formula? Aug 20, 2014 at 10:04
• 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. Jun 20, 2015 at 18:44
• Thanks @FrankHarrell, I will remember not to do this :) Jun 21, 2015 at 13:15

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).

• please edit yout question with a link to a vignette Jun 21, 2015 at 8:51
• I meant the manual, not the vignette. Jun 21, 2015 at 13:34
• Have you noticed that the p-values from this package are in relations p1=1-p2 of standard SAS output? Where p1 is p-value from R package, and p2 is p-value from SAS? Jun 24, 2015 at 21:03
• Yes, I have noticed that. And sometimes the results are slightly different then these obtained from SAS. Jul 7, 2015 at 9:41
• That's quite funny ins't it? Jul 7, 2015 at 9:42

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.