6
$\begingroup$

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?

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

2 Answers 2

3
$\begingroup$

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

$\endgroup$
9
  • $\begingroup$ please edit yout question with a link to a vignette $\endgroup$ Jun 21, 2015 at 8:51
  • $\begingroup$ I meant the manual, not the vignette. $\endgroup$
    – potockan
    Jun 21, 2015 at 13:34
  • $\begingroup$ 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? $\endgroup$ Jun 24, 2015 at 21:03
  • 1
    $\begingroup$ Yes, I have noticed that. And sometimes the results are slightly different then these obtained from SAS. $\endgroup$
    – potockan
    Jul 7, 2015 at 9:41
  • $\begingroup$ That's quite funny ins't it? $\endgroup$ Jul 7, 2015 at 9:42
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.