我正在try 使用R中的tidycmprsk包进行竞争风险分析.
我的数据集遇到了一个问题,因为没有经过审查的 case (数据集中的每个人都经历了三种结果之一).
From the documentation:
The event status variable must be a factor, with the first level indicating ’censor’ and subsequent levels the competing risks.
你有什么办法绕过这一关吗?否则,它会将我的一个级别/结果视为审查,而实际上它是感兴趣的结果.
例如,下面列出了累积发病率曲线,并给出了两种结果--癌症死亡和其他原因死亡:
library(tidycmprsk)
cuminc(Surv(ttdeath, death_cr) ~ trt, trial)
但如果你go 掉被审查的 case ,现在它只给出一种失败类型的结果,认为另一种是你的被审查变量:
data <- trial %>%
mutate(death_cr_new = case_when(
death_cr=="censor" ~ 2,
death_cr=="death from cancer" ~ 2,
death_cr=="death other causes" ~ 3
))
data$death_cr_new<-as.factor(data$death_cr_new)
cuminc(Surv(ttdeath, death_cr_new) ~ trt, data)