[R] only need the p-value
Ritwik Sinha
ritwik.sinha at gmail.com
Sat Sep 30 15:38:48 CEST 2006
This is how you go about doing this.
summary(results)$coefficients[1,5]
You will have to check this for you code. But the idea is that
summary(results) is a list (?) and one of its components is called
"coefficients", which is a matrix. So the problem is just to extract
one element of this matrix.
I am not well versed with coxph so there may be some minor details I
am missing, but that is the general idea (same as with lm, glm etc.).
Ritwik.
On 9/30/06, Boks, M.P.M. <M.P.M.Boks at umcutrecht.nl> wrote:
>
>
> Dear R users,
>
>
>
> I am calculating several cox proportional hazard models after each other (I know this is unusual, but I am just exploring the data). For the purpose of multiple testing correction I need to construct an array of these p-values. However since the output is not an array in itself, I cannot find a way to obtain the p-value only.
>
>
>
> > attach(tms)
>
> >
>
> > goal<-rep(0.7*FREQUENC[1:13],6)
>
> > event<- Surv(TIJD,FREQUENC<goal)
>
> > results<-coxph(event~ TYPETREA)
>
> > summary(results)
>
>
>
> Call:
>
> coxph(formula = event ~ TYPETREA)
>
>
>
> n=76 (2 observations deleted due to missing)
>
> coef exp(coef) se(coef) z p
>
> TYPETREAnon-guided -0.826 0.438 0.484 -1.71 0.088
>
>
>
> exp(coef) exp(-coef) lower .95 upper .95
>
> TYPETREAnon-guided 0.438 2.28 0.169 1.13
>
>
>
> Rsquare= 0.041 (max possible= 0.829 )
>
> Likelihood ratio test= 3.2 on 1 df, p=0.0737
>
> Wald test = 2.91 on 1 df, p=0.088
>
> Score (logrank) test = 3.08 on 1 df, p=0.0794
>
>
>
> Does anyone now how to extract the p-value?
>
> Many thanks!,
>
> Marco
>
> ______________________________________________
> R-help at 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.
>
--
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
ritwik.sinha at gmail.com | +12163682366 | http://darwin.cwru.edu/~rsinha
More information about the R-help
mailing list