[R] retrieve p-value from a cox.obj

Bert Gunter gunter.berton at gene.com
Wed Aug 29 18:40:50 CEST 2007

str() is your friend. It tells you about the structure of any R object, from
which you can usually glean what you need to know to get what you want. It
is often useful to use it on summary(object) rather than on the object, as
the summary method for an (S3) classed object often contains what you're
looking for.

Less generally, names() and as.list() can sometimes get you what you want

Alternatively, check the summary.coxph() code (survival:::summary.coxph, as
it's hidden in the namespace). It is clear there how to get what you want,
either direct from the fitted object or from the summary.coxph object.

Bert Gunter
Genentech Nonclinical Statistics

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of clearsky
Sent: Wednesday, August 29, 2007 8:41 AM
To: r-help at stat.math.ethz.ch
Subject: [R] retrieve p-value from a cox.obj

I have a cox.obj named obj, 
obj <- coxph( Surv(time, status) ~ group, surv.data)
now I want to retrieve the p-value from obj, so that I can run this hundreds
of times and plot out the distribution of the p-value. could anyone tell me
how to get p-value from obj?


View this message in context:
Sent from the R help mailing list archive at Nabble.com.

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list