[R] Extract p-value from survdiff function

Petr Klasterecky klaster at karlin.mff.cuni.cz
Thu Apr 26 21:48:38 CEST 2007


You have the Chi^2 statistic and you know that it is on 1 degree of 
freedom with a 2-sample test. So

sdf <- survdiff(...)
pchisq(sdf$chisq, df=1, lower=FALSE)

might help in quite a common case. Generally you'll have to look at the 
printing function and make a modified copy to save the p-value:

getAnywhere(print.survdiff)

hth
Petr

Armin Goralczyk napsal(a):
> Hi list,I want to use the p-value from the survdiff function (packagesurvival) to reuse within a function in a Kaplan-Meier plot. Thep-value is somehow not a component of the value list ?!
> Thanks in advance-- A. GoralczykGöttingen, Ger.
> ______________________________________________R-help at stat.math.ethz.ch mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
> 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic



More information about the R-help mailing list