retrieve p-value from a cox.obj

View: New views
7 Messages — Rating Filter:   Alert me  

retrieve p-value from a cox.obj

by clearsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

thanks,

Re: retrieve p-value from a cox.obj

by Bert Gunter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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@...
[mailto:r-help-bounces@...] On Behalf Of clearsky
Sent: Wednesday, August 29, 2007 8:41 AM
To: r-help@...
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?

thanks,

--
View this message in context:
http://www.nabble.com/retrieve-p-value-from-a-cox.obj-tf4348520.html#a123896
52
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@... 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.

______________________________________________
R-help@... 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.

Re: retrieve p-value from a cox.obj

by clearsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried obj$p, obj$pvalue, but they both returned null~~

clearsky wrote:
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?

thanks,

Re: retrieve p-value from a cox.obj

by Henrique Dallazuanna :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

See the source code of function:

survival:::print.coxph



--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

On 29/08/2007, clearsky <haiyingwithu@...> wrote:

>
>
> I tried obj$p, obj$pvalue, but they both returned null~~
>
>
> clearsky wrote:
> >
> > 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?
> >
> > thanks,
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/retrieve-p-value-from-a-cox.obj-tf4348520.html#a12390960
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@... 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.
>
        [[alternative HTML version deleted]]


______________________________________________
R-help@... 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.

Re: retrieve p-value from a cox.obj

by clearsky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Bert . It is a lot help!

gunter.berton wrote:
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
also.

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@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of clearsky
Sent: Wednesday, August 29, 2007 8:41 AM
To: r-help@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?

thanks,

--
View this message in context:
http://www.nabble.com/retrieve-p-value-from-a-cox.obj-tf4348520.html#a123896
52
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@stat.math.ethz.ch 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.

______________________________________________
R-help@stat.math.ethz.ch 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.

Parent Message unknown Re: retrieve p-value from a cox.obj

by Therneau, Terry M., Ph.D. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
 Several responders have given input on how to find and read the code for
summary.coxph and print.coxph, or using str() to examine the output of a
coxph object.

  An even better starting place would be the documentation (yes there is some).
 
help(coxph) gives a page that contains:

  "Value:  an object of class coxph.  See 'coxph.object' for details."
 
and help(coxph.object) gives a description of all the components.

        Terry Therneau

______________________________________________
R-help@... 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.

Re: retrieve p-value from a cox.obj

by Bernardo Rangel tura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2007-08-29 at 08:40 -0700, clearsky wrote:
> 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?
>
> thanks,
Hi Clearsky

try: summary(obj)$waldtest[3]


--
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil

______________________________________________
R-help@... 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.