[R] Scoring using cox model: probability of survival before time t

Terry Therneau therneau at mayo.edu
Wed Jan 18 15:36:31 CET 2012


--begin included message ---

Dear Members,
I required to score probability of survival before specified time using
fitted cox model on scoring dataset.
On the training sample data I am able to get the probability of a
survival
before time point(t), but on the scoring dataset, which will have only
predictor information I am facing some issues. It would be great help
for me
if you tell me where am I going wrong!
Here is the sample script!

------------------

 Your example isn't complete: the error comes from a function
predictProb.coxph() which I have never heard of, and I wrote the
survival library.  I obviously can't comment on why it fails -- you
might want to contact the author of the function.
 
 Using only the survival library (one of the more recent versions), you
need to know the fact that Pr(survival to t) = exp(-expected events by
t), then you can use
	predict(fit_coxph, type="expected", newdata=....)
where newdata has a time variable that contains the desired time point
for prediction.

  Note, by default the coxph result does not store all of the data
needed to make predicted survivals (it needs to keep the entire X
matrix).  You can override this by adding "model=TRUE" to the original
call.  If you do not, then it needs to look up the orginal data set to
do the prediction.  

Terry Therneau



More information about the R-help mailing list