Skip to content

Getting estimates from survfit.coxph

3 messages · Terry Therneau, Mark Wardle, Peter Dalgaard

#
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
#
Can't ask for more than that!

Many many thanks for making all these tools available. I wince when I
see my colleagues struggling with SPSS or SAS! R and the bundled and
third-party libraries have saved me an inordinate amount of time and
effort!

Best wishes,

Mark
On 10/12/2007, Terry Therneau <therneau at mayo.edu> wrote:

  
    
#
Terry Therneau wrote:
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