I am trying to generate quantile-type survival time predictions from a Cox proportional hazards model, similar to those generated from:
library(survival)
data(lung)
lung <- na.omit(lung)
lung <- data.frame(apply(lung, 2, as.numeric))
set.seed(123)
train.idx <- sample.int(nrow(ls), size=0.8*nrow(ls))
lung.train <- lung[train.idx,]
lung.test <- ls[-train.idx,]
weibull.aft <- survreg(Surv(time, status) ~ ., data=lung.train, dist='weibull')
predict(weibull.aft, newdata=lung.test, type='quantile', p=(1:999)/1000)
Is there a way to generate predictions in this format from a Cox proportional hazards model such as the one below:
model <- coxph(Surv(time, status) ~ pspline(inst) + pspline(age)
+ pspline(ph.ecog) + pspline(ph.karno) + pspline(pat.karno)
+ pspline(meal.cal) + pspline(wt.loss) + sex, data=lung.train,
method='breslow')
Thanks!