我有一个理论上的问题,想知道是否有人可以向我解释这一点。 我目前在R中使用命令 coxph 对我的数据集执行生存分析。但是,我遇到了一个有关R如何处理零故障时间的问题。
在我的数据集中,我的患者的随访时间为零(t = 0),并且注意到当执行Cox比例风险模型时,R命令 coxph 并未排除这些患者。这些患者从一开始就被包括在风险集中,并且似乎为该模型的输出做出了贡献。此外,当排除这些患者并随后执行cox PH模型时,将返回不同的beta系数结果。
我很好奇为什么要包括这些人,以及当t = 0时 coxph 命令如何执行这种类型的分析,并且想知道是否有人可以澄清这一点。
我用一个小的测试数据集进行了尝试,并得到了两个不同的结果。
id <- c(1:10)
event <- c(0,0,0,0,0,1,1,1,1,1)
time <- c(1, 2, 3, 4, 0, 1, 2, 3, 0, 0)
age <- c(30, 40, 22, 25, 60, 30, 40, 22, 25, 60)
test <- data.frame(id, event, time, age, stringsAsFactors=FALSE)
test.cox <- coxph(Surv(time, event)~age, data=test)
test.cox
Call:
coxph(formula = Surv(time, event) ~ age, data = test)
coef exp(coef) se(coef) z p
age 0.04393 1.04491 0.04151 1.058 0.29
Likelihood ratio test=1.1 on 1 df, p=0.2937
n= 10, number of events= 5
# Remove patients with follow up time is zero
test_min0 <- test[test$time!=0,]
test.cox_min0 <- coxph(Surv(time, event)~age, data=test_min0)
test.cox_min0
Call:
coxph(formula = Surv(time, event) ~ age, data = test_min0)
coef exp(coef) se(coef) z p
age 0.07575 1.07870 0.09487 0.798 0.425
Likelihood ratio test=0.7 on 1 df, p=0.4042
n= 7, number of events= 3