[R] Re: survfit on coxph object with weights

Terry Therneau therneau at mayo.edu
Thu Jul 18 06:27:59 CEST 2002


 If you don't need the confidence intervals, which is the part of the formula
that I got hung up on, then there is an easy way to get the survival curve.
(A continual succession of other things to do has kept me from getting back to
this problem.)

   fit <- coxph(Surv(.....  etc etc
   details <- coxph.detail(fit)
   
The coxph.detail routine was originally written for debugging; it returns
nearly every intermediate internal computation that coxph does.

  The cumulative hazard can be plotted as
  
  	plot(details$time, cumsum(details$hazard))
  	   
This is for a hypothetical subject whose covariates are details$means[1,].
For a general subject with covariates x, multiply the cumulative hazard
by exp(sum(fit$coef * (x-details$means)))

	Terry Therneau
	
	  	   
  	   

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list