Thanks for your thoughts.


1. The function is 'somewhat' linear. Small curvature but beginning and end are similar. Off course I could fit more complex functions of time.

2. Do I really have to build (start, stop) datasets as I have time-varying covariate effect but not time-varying covariate? Covariate seems to have an effect to end point initially  but starts to diminish after sometime.

3. Does this point hold in case of time-varying covariate effect also? I try to get my hands on the book you mentioned

I have a competing risk setting where there is a competing risk of death. I carry deaths forward to the end of followup time as we know the potential followup time for every individual (subdistribution hazard regression).
A Proportional Hazards Model for the  Subdistribution of a Competing Risk, Jason P. Fine and Robert J. Gray Journal of the American Statistical Association Vol. 94, No. 446 (Jun., 1999), pp. 496-509

But I guess that does not have an effect on the matter at hand.

Mitja

On 8.10.2012, at 16.25, Terry Therneau wrote:


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)

 Some comments:
    1. even though it is in the SAS manual and some literature, I have myself never used
 "X * log(time)" as a fix for lack  of proportionality.  Is it really true that when you
use
       fit <- coxph(Surv(event_time_mod, event_indicator_mod) ~ Sex +
            ageC + HHcat_alt + Main_Branch + Acute_seizure + TreatmentType_binary +
             ICH + IVH_dummy)
       zfit <- cox.zph(fit, transform="log")
       plot(zfit[8])

that the estimated function is linear?  I have not yet seen such a simple time effect
and would find it interesting.

    2. The code you wrote does not fit the time dependent model that you suppose; it
treats event_time_mod as a fixed covariate.  To fit the model see the relevant vignette
for the survival package.  Essentially the program has to build a large (start, stop) data
set behind the scenes.  (SAS does the same thing).  Defining proper residuals for said
data set is hard and the R code does not yet do this.  (Last I checked, SAS did the same
thing.)

    3. The "survival curve" for a time dependent covariate is something that is not
easily defined.  Read chapter 10.2.4 of the Therneau and Grambch book for a discussion of
this (largely informed by the many mistakes I've myself made.)

Terry Therneau


	[[alternative HTML version deleted]]


