[R] survival predictions

Mitja Kurki mitja.kurki at uef.fi
Fri Oct 5 17:12:16 CEST 2012


Dear All,

I have built a survival cox-model, which includes a covariate * time interaction. (non-proportionality detected)
I am now wondering how could I most easily get survival predictions from my model.

My model was specified:
coxph(formula = Surv(event_time_mod, event_indicator_mod) ~ Sex + 
    ageC + HHcat_alt + Main_Branch + Acute_seizure + TreatmentType_binary + 
    ICH + IVH_dummy + IVH_dummy:log(event_time_mod) 

And now I was hoping to get a prediction using survfit and providing new.data for the combination of variables 
I am doing the predictions:
	  survfit(cox, new.data=new)

Now as I have event_time_mod in the right-hand side in my model I need to specify it in the new data frame passed on 
to survfit. This event_time would need to be set at individual times of the predictions. Is there an easy way to specify event_time_mod to be the correct time to  survfit?
Or are there any other options for achieving predictions from my model?

Of course I could create as many rows in the new data frame as there are distinct times in the predictions and setting to event_time_mod to correct values but it feels really cumbersome and
I thought that there must be a better way.


Best,

Mitja



More information about the R-help mailing list