Hi, I am working on a study where we need to predict individual survival curves from a cox-model fit with sampling weights. In both R and Splus the survfit.coxph code starts with if(!is.null((object$call)$weights)) stop("Survfit cannot (yet) compute the result for a weighted model") My question is does anyone have code to get the expected survival curve, or even just the base cumulative hazard (H^{\hat}_{0}(t)) ? I am surprised that it is not implemented yet since a formula is given on page 35 of Dr. Therneau's report, "a package for survival analysis in S" for the base cumulative hazard with weights. I am looking at the source for survfit.coxph to see if I can fix it myself, but if someone has they can share I can get my report out and go back and send a patch later. Thanks for any help. Nicholas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Seemingly Similar Threads
- Is the output of survfit.coxph survival or baseline survival?
- How to compute hazard function using coxph.object
- Reporting Kaplan-Meier / Cox-Proportional Hazard Standard Error, km.coxph.plot, survfit.object
- Problems with coxph and survfit in a stratified model with interactions
- Fitting and plotting a coxph with survfit, package(surv)