4

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.

4

1 回答 1

3

你已经完成了所谓的

一个明显但不正确的方法......

如在R包2.41-3 版中的 Cox 模型小插图中使用时间相关协变量和时间相关系数中所述。survival相反,您应该使用时间转换功能,即tt同一个小插图中所述的功能。该代码将类似于小插图中的示例

> library(survival)
> vfit3 <- coxph(Surv(time, status) ~ trt + prior + karno + tt(karno),
+                data=veteran,
+                tt = function(x, t, ...) x * log(t+20))
> 
> vfit3
Call:
coxph(formula = Surv(time, status) ~ trt + prior + karno + tt(karno), 
    data = veteran, tt = function(x, t, ...) x * log(t + 20))

              coef exp(coef) se(coef)     z       p
trt        0.01648   1.01661  0.19071  0.09  0.9311
prior     -0.00932   0.99073  0.02030 -0.46  0.6462
karno     -0.12466   0.88279  0.02879 -4.33 1.5e-05
tt(karno)  0.02131   1.02154  0.00661  3.23  0.0013

Likelihood ratio test=53.8  on 4 df, p=5.7e-11
n= 137, number of events= 128 

当你有一个术语时,survfit虽然不起作用tt

> survfit(vfit3, veteran[1, ])
Error in survfit.coxph(vfit3, veteran[1, ]) : 
  The survfit function can not yet process coxph models with a tt term

但是,您可以使用 轻松获得terms线性预测变量或平均响应predict此外,您可以使用此处tt的答案随着时间的推移为术语创建术语。

于 2017-10-15T21:14:26.577 回答