9
$\begingroup$

Say you have survival data like this:

obs <- data.frame(
  time = c(floor(runif(100) * 30), floor((runif(100)^2) * 30)),
  status = c(rbinom(100, 1, 0.2), rbinom(100, 1, 0.7)),
  group = gl(2,100)
  )

To perform a standard log rank test, one can use

survdiff(Surv(time, status) ~ group, data = obs, rho = 0)

right?

But what about other test? How could you perform a Wilcoxon signed rank test, a Peto test or a Fleming-Harrington test?

R provides a possibility to perform a Wilcoxon test, however I didn't find how to let it take censoring into account.

Furthermore the doc states that setting rho = 1 would make the test a "Peto & Peto modification of the Gehan-Wilcoxon test". But is this the same as the Peto test?

$\endgroup$

migrated from stackoverflow.com Feb 22 '12 at 16:45

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ I don't know my survival data, but google seems to: Wilcox Test And reading the docs for survdiff setting rho=1 makes it a Peto test... $\endgroup$ – Justin Feb 22 '12 at 15:39
  • $\begingroup$ yes, thank you! this is as far as I got aswell. However, I didn't find a way to let the wilcox.test take censoring into account. With rho=1 I am unsure if this is a Peto test or a Wilcoxon test, as the doc states "Peto & Peto modification of the Gehan-Wilcoxon test". No need to downvote. $\endgroup$ – Marcel Feb 22 '12 at 15:58
7
$\begingroup$

(You should probably cite the source for your naming conventions and explain in more detail why this question is being posed. If this a case of trying to match the documentation for SAS or SPSS we might have cross-cultural difficulties.)

The quick answer to your specific question about how to get a "Peto test" is to use rho=1, but it will be an approximation. Referring to the one-sample and two-sample sections of chapter 7 in Klein and Moeschberger's "Survival Analysis", we read that the Peto-Peto version and the Gehan versions were both two-sample (censored) versions of the Mann-Whitney Wilcoxon two-sample test but used different versions of the survival function estimator. There is no single 'Fleming-Harrington test' since that term refers to a family of tests which reduce to the log-rank and the Wilcoxon-type tests at specified values of rho. (The R/S surv.diff function has the q-parameter of the Fleming-Harrington family fixed at 0 and only varies the p-parameter which it names rho.)

A meta-question is whether you should be focusing on the names and not on the mathematical substance? Choosing p=rho=0 (with q fixed at 0) in the Fleming-Harrington family weights the (O-E) or cross-group differences equally across the range of times, whereas both the Gehan-Wilcoxon and Peto-Peto tests weight the early deaths more strongly. My opinion (as a physician) is that it's sensible to have a weighting the considers early differences more probative for the typical case, but can imagine specific instances where the other choice could be defended.

$\endgroup$
  • $\begingroup$ Thank you for your explanation. My naming conventions come from "Kleinbaum & Klein - Survival Analysis" (p. 63ff). They define w(t_j) = 1 for Log Rank, w(t_j) = n_j for Wilcoxon, w(t_j) = n^(1/2) for Tarone-Ware, w(t_j) = s(t_j) for Peto, and a rather difficult expression for Flemington-Harrington. I don't know which weights I will need in the future but I want to be sure that I am able to apply them before I need them :) But I think your answer will help me with this problem. Thank you! $\endgroup$ – Marcel Feb 23 '12 at 16:06
5
$\begingroup$

To answer your question on how to calculate this in R, you can use the comp() function from the survMisc package. Example:

> library(survMisc)
> fit = survfit(Surv(time, status) ~ x, data = aml)
> comp(fit)$tests$lrTests
                              ChiSq df      p
Log-rank                       3.40  1 0.0653
Gehan-Breslow (mod~ Wilcoxon)  2.72  1 0.0989
Tarone-Ware                    2.98  1 0.0842
Peto-Peto                      2.71  1 0.0998
Mod~ Peto-Peto (Andersen)      2.64  1 0.1042
Flem~-Harr~ with p=1, q=1      1.45  1 0.2281

To choose the parameters for the Fleming-Harrington test (shown in the last line), you use the FHp and FHq arguments. For example,

> comp(fit, FHp=0, FHq=0)$tests$lrTests
[…]
Flem~-Harr~ with p=0, q=0      3.40  1 0.0653

gives you the normal log-rank test (also shown in the first line in the first example).

$\endgroup$
  • 1
    $\begingroup$ In the current survMisc version (0.5.4) it should be comp(ten(fit)) $\endgroup$ – Marcin Kosiński Jan 27 '17 at 15:52

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.