I am fitting a coxph model on a large dataset (approx 100,000 patients), and
then trying to estimate the survival curves for several new patients based
on the coxph object using survfit.  When I run coxph I get the coxph object
back fairly quickly however when I try to run survfit  it does not come
back. I  am wondering if their is a more efficient way to get predicted
survival curves from a coxph object.predict.coxph does not seem to generate
survival curves.

here is some sample code that mirrors what I am trying to do with my
dataset, I get results using this code but it still takes a long time, my
dataset includes quite a few more covariates, so any suggestions on speeding
this up would be greatly appreciated.


library(survival)
### generate sample data
time <- rexp(100000,(1/180))
ag <- rnorm(100000,38,12)
sx <- sample(x=c(0,1),100000,replace=TRUE)
ac <- factor(sample(x=c(1,2,3,4,5),100000,replace=TRUE),levels=c(1:5))
ev <- sample(x=c(0,1),100000,replace=TRUE)
c1 <- as.data.frame(cbind(ag,sx,ac))

#generate newdata
ts <- as.data.frame
(cbind(ag[23:24],sx[1000:1001],factor(ac[9000:9001],levels=c(1:5))))
colnames(ts) <- c("ag","sx","ac")


cph <- coxph(Surv(time,ev)~ ag+sx+ac,data=c1)

survfit(cph,newdata=ts,individual=F)



thanks,

Spencer

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to