Hello, is there a R package that provides a log rank trend test for survival data in >=3 treatment groups? Or are there any comparable trend tests for survival data in R? Thanks a lot Markus -- Dipl. Inf. Markus Kreuz Universitaet Leipzig Institut fuer medizinische Informatik, Statistik und Epidemiologie (IMISE) Haertelstr. 16-18 D-04107 Leipzig Tel. +49 341 97 16 276 Fax. +49 341 97 16 109 email: markus.kreuz at imise.uni-leipzig.de
Dear Markus! Since I did not see an answer yet, my suggestion is to use coxph with the groups variable numerically coded as the only independent variable. Heinz At 13:39 21.04.2008, Markus Kreuz wrote:>Hello, >is there a R package that provides a log rank trend test >for survival data in >=3 treatment groups? >Or are there any comparable trend tests for survival data in R? > >Thanks a lot >Markus > >-- >Dipl. Inf. Markus Kreuz >Universitaet Leipzig >Institut fuer medizinische Informatik, Statistik und Epidemiologie (IMISE) >Haertelstr. 16-18 >D-04107 Leipzig > >Tel. +49 341 97 16 276 >Fax. +49 341 97 16 109 >email: markus.kreuz at imise.uni-leipzig.de > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
> Hello, > is there a R package that provides a log rank trend test > for survival data in >=3 treatment groups? > Or are there any comparable trend tests for survival data in R?The log-rank test is equivalent to a Cox model with a factor variable as the predictor. To do a trend test, simply fit the Cox model with the variable scored as 1,2,3,... Or fit it as a factor and do a post-hoc trend test:> fit1 <- coxph(Surv(time, status) ~ ph.ecog, data=lung) > fit1Call: coxph(formula = Surv(time, status) ~ ph.ecog, data = lung) coef exp(coef) se(coef) z p ph.ecog 0.476 1.61 0.113 4.2 2.7e-05 Likelihood ratio test=17.6 on 1 df, p=2.77e-05 n=227 (1 observation deleted due to missingness)> fit2 <- coxph(Surv(time, status) ~ factor(ph.ecog), data=lung) > fit2coef exp(coef) se(coef) z p factor(ph.ecog)1 0.369 1.45 0.199 1.86 6.3e-02 factor(ph.ecog)2 0.916 2.50 0.225 4.08 4.5e-05 factor(ph.ecog)3 2.208 9.10 1.026 2.15 3.1e-02 Likelihood ratio test=18.4 on 3 df, p=0.000356 n=227 (1 observation deleted due to missingness)> zz <- c(1,2,3) > test.num <- zz %*% coef(fit2) > test.var <- zz %*% fit2$var %*% zz > test.num/sqrt(test.var)[,1] [1,] 2.74323 Note that ecog performace score=0 is implicitly part of the contrast. The full coefficient vector is (0, .369, .916, 2.208) and my linear contrast zz is 0,1,2,3. Terry Therneau