Re: [R] Getting estimates from survfit.coxph

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Mon, 10 Dec 2007 23:51:37 +0100

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

______________________________________________
R-help_at_r-project.org 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.
Received on Mon 10 Dec 2007 - 23:06:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Dec 2007 - 00:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.