[R] Getting estimates from survfit.coxph

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Dec 10 23:51:37 CET 2007


Terry Therneau wrote:
>   The problem will be fixed in the next resease of the survival code.  (That is, 
> it is fixed on our local version of R).  The summary.survfit result now includes 
> an element 'table' containing the matrix that is shown by print.survfit.   
>   
>   	Terry
>   
Hi Terry,

Speaking of coxph...

I noticed a silly inconsistency between summary.coxph and other modeling 
functions:

 > m <- summary( coxph( Surv(start, stop, event) ~ x, test2))
 > coef(m)
NULL
 > m$coef
coef exp(coef) se(coef) z p
x -0.02110521 0.979116 0.7951769 -0.02654153 0.98

 > coef(summary(lm.D9))
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.032 0.2202177 22.850117 9.547128e-15
groupTrt -0.371 0.3114349 -1.191260 2.490232e-01

 > summary(lm.D9)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.032 0.2202177 22.850117 9.547128e-15
groupTrt -0.371 0.3114349 -1.191260 2.490232e-01


the problem being that stats:::coef.default is looking for 
object$coefficients but summary.coxph uses rval$coef.

And while we're at it, if your "p" column was renamed "Pr(>|z|)" or so, 
then printCoefmat could have been used. Apart from significance stars 
(which you might well dislike), this also provides a nicer display of 
the p values themselves:

 > printCoefmat(summary(lm.D9)$coef)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.03200 0.22022 22.8501 9.547e-15 ***
groupTrt -0.37100 0.31143 -1.1913 0.249
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list