Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用相同的停止和启动时间,从R中的coxph得到两个不同的结果,为什么?_R_Survival Analysis_Survival - Fatal编程技术网

使用相同的停止和启动时间,从R中的coxph得到两个不同的结果,为什么?

使用相同的停止和启动时间,从R中的coxph得到两个不同的结果,为什么?,r,survival-analysis,survival,R,Survival Analysis,Survival,我在生存分析中遇到了障碍;我认为这与审查类型有关。这是我的前30行生存数据。tstart是指患者入院并开始接受干预时,tstop为死亡(状态=1)或出院(已审查,状态=0): 根据我如何将这些数据输入coxph函数,我会得到两个不同的结果。即: # METHOD ONE: > coxph (Surv (time = (tstop - tstart), event = status) ~ Intervention, data = df.use) Call: coxph(formula = S

我在生存分析中遇到了障碍;我认为这与审查类型有关。这是我的前30行生存数据。tstart是指患者入院并开始接受干预时,tstop为死亡(状态=1)或出院(已审查,状态=0):

根据我如何将这些数据输入coxph函数,我会得到两个不同的结果。即:

# METHOD ONE:
> coxph (Surv (time = (tstop - tstart), event = status) ~ Intervention, data = df.use)
Call:
coxph(formula = Surv(time = (tstop - tstart), event = status) ~ 
    Intervention, data = df.use)

                     coef exp(coef) se(coef)      z     p
InterventionTRUE -0.05975   0.94200  0.04727 -1.264 0.206

Likelihood ratio test=1.58  on 1 df, p=0.2084
n= 7362, number of events= 2364 

# METHOD TWO:
> coxph (Surv (time = tstart, time2 = tstop, event = status) ~ Intervention, data = df.use)
Call:
coxph(formula = Surv(time = tstart, time2 = tstop, event = status) ~ 
    Intervention, data = df.use)

                     coef exp(coef) se(coef)      z             p
InterventionTRUE -0.29936   0.74129  0.04902 -6.106 0.00000000102

Likelihood ratio test=35.67  on 1 df, p=0.000000002337
n= 7362, number of events= 2364 
我原以为这两种方法会返回相同的风险比,但结果却截然不同。为什么会这样?如何避免呢?

我不相信
Surv(time=(tstop-tstart),event=status)
等同于
Surv(time=tstart,time2=tstop,event=status)
time
time2
之间的间隔并不是全部观察结果,而是已知死亡或审查发生的时间。因此,所有死亡事件的
时间
时间2
都相等
tstop-tstart


当您不知道死亡时间或审查时间是多少,但您知道它在两个值之间时,使用间隔。

这更像是一个统计问题,而不是一个编程问题。简而言之,这两种方法是两种不同的东西。您应该仅对间隔截尾数据使用time2。你的研究设计暗示了正确的审查数据,因此方法1是正确的——这就是你应该使用的方法。谢谢,明白了。当我试图最终进行时间依赖性生存分析时(其中一个时间段患者没有接受干预,第二个时间段患者正在接受干预),我认为我必须使用第二种格式(w/时间和时间2)。我现在将提出一个新问题,重点是这个问题。谢谢你的帮助。我已经在上问了我的新问题,如果你能阅读,我将不胜感激。谢谢,谢谢,我明白了。当我试图最终进行时间依赖性生存分析时(其中一个时间段患者没有接受干预,第二个时间段患者正在接受干预),我认为我必须使用第二种格式(w/时间和时间2)。我现在将提出一个新问题,重点是这个问题。谢谢你的帮助。我已经在上问了我的新问题,如果你能阅读,我将不胜感激。非常感谢。
# METHOD ONE:
> coxph (Surv (time = (tstop - tstart), event = status) ~ Intervention, data = df.use)
Call:
coxph(formula = Surv(time = (tstop - tstart), event = status) ~ 
    Intervention, data = df.use)

                     coef exp(coef) se(coef)      z     p
InterventionTRUE -0.05975   0.94200  0.04727 -1.264 0.206

Likelihood ratio test=1.58  on 1 df, p=0.2084
n= 7362, number of events= 2364 

# METHOD TWO:
> coxph (Surv (time = tstart, time2 = tstop, event = status) ~ Intervention, data = df.use)
Call:
coxph(formula = Surv(time = tstart, time2 = tstop, event = status) ~ 
    Intervention, data = df.use)

                     coef exp(coef) se(coef)      z             p
InterventionTRUE -0.29936   0.74129  0.04902 -6.106 0.00000000102

Likelihood ratio test=35.67  on 1 df, p=0.000000002337
n= 7362, number of events= 2364