Question: How To Isolate The P-Value When Doing Survival Analysis Using The Coxph Package In Bioconductor.
2
gravatar for moranr
7.7 years ago by
moranr270
Ireland
moranr270 wrote:

Hi,

I have done survival analysis on a gene, using the coxph call and saved it in a variable a. I know i can do summary(a) and get a return with the coef, exp(coef), se(coef) and power- p-value. I want to take JUST the p-value out of a to put into a a matrix.

So essentially is there a way of accessing just the p-value form a coxph object , e.g. coefVal <- a$coef gives me the coef value.. ?

Thanks, R

R bioconductor • 12k views
ADD COMMENTlink modified 7.7 years ago by Istvan Albert ♦♦ 85k • written 7.7 years ago by moranr270
7
gravatar for zx8754
7.7 years ago by
zx87549.7k
London
zx87549.7k wrote:

Assign coef summary to a variable

coeffs <- coef(summary(a))

coeffs should be something like this:

Estimate  Std.    Error    z    value    Pr(>|z|)
(Intercept)    -3.86370076    0.71438758    -5.40840977    6.358681e-08
A    20.62019096    264.13705493    0.07806626    9.377753e-01
B    4.00226650    0.71574200    5.59177257    2.247631e-08
C    4.50171396    0.71849626    6.26546610    3.717119e-10
...

Subset 4th column as P is 4th column in this example:

as.matrix(coeffs[,4])
    [,1]
(Intercept)    6.358681e-08
A    9.377753e-01
B    2.247631e-08
C    3.717119e-10
...
ADD COMMENTlink written 7.7 years ago by zx87549.7k
2

I was banging  my head for half an hour and this saved my day :)

Thanks :)

ADD REPLYlink written 4.7 years ago by Veera 90

Thank you, It was so frustrating as it should be very simple, I am not experienced in R and sometimes the simplest things can leave me baffled. Thank you this really helps me learn.

ADD REPLYlink written 7.7 years ago by moranr270
3

A very useful function to help sort out complex data structures is the str() function applied to the object in question.

ADD REPLYlink written 7.7 years ago by Sean Davis26k

Thanks very much , Ill read about this.

ADD REPLYlink written 7.7 years ago by moranr270
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 939 users visited in the last hour