10

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?

chl
  • 50,972
  • 18
  • 205
  • 364
Marcel
  • 339
  • 2
  • 4
  • 11
  • I don't know my survival data, but google seems to: [Wilcox Test](http://www.r-tutor.com/elementary-statistics/non-parametric-methods/wilcoxon-signed-rank-test) And reading the docs for `survdiff` setting `rho=1` makes it a Peto test... – Justin Feb 22 '12 at 15:39
  • 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. – Marcel Feb 22 '12 at 15:58

2 Answers2

7

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

Karl Ove Hufthammer
  • 5,202
  • 2
  • 23
  • 32
7

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

DWin
  • 7,005
  • 17
  • 32
  • 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! – Marcel Feb 23 '12 at 16:06