Extract p-value from survdiff function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Extract p-value from survdiff function

Armin Goralczyk
Hi list,
I want to use the p-value from the survdiff function (package
survival) to reuse within a function in a Kaplan-Meier plot. The
p-value is somehow not a component of the value list ?!

Thanks in advance
--
A. Goralczyk
Göttingen, Ger.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Extract p-value from survdiff function

Christos Hatzis
If

sdf <- survdiff(...)
 
is your survdiff object, the p-value can be computed as follows:

p.val <- 1 - pchisq(sdf$chisq, length(sdf$n) - 1)

and then use it in your K-M plot.

-Christos

Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
 


> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Armin Goralczyk
> Sent: Thursday, April 26, 2007 3:03 PM
> To: [hidden email]
> Subject: [R] Extract p-value from survdiff function
>
> Hi list,
> I want to use the p-value from the survdiff function (package
> survival) to reuse within a function in a Kaplan-Meier plot.
> The p-value is somehow not a component of the value list ?!
>
> Thanks in advance
> --
> A. Goralczyk
> Göttingen, Ger.
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Extract p-value from survdiff function

Petr Klasterecky
In reply to this post by Armin Goralczyk
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.
> [hidden email] 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

______________________________________________
[hidden email] 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.