Solved – Survfit function in R to score a new dataset

cox-modelpredictionsurvival

I have built a cox proportional hazards model in the R survival package. I want to score new data set using this model. I thought the survfit function would doing this using survfit(original model, newdata), but it only seems to predict only the outcomes for the original data, not the original model using the new data.

Any insight is appreciated!

Best Answer

Use the predict function. According to the survival package documentation there is a predict.coxph function, so when that package is loaded and you pass predict a coxph object it will use it for prediction with your new data. See ?predict.coxph for the additional arguments.