我正在使用 mlr,并且希望能够将 Cox PH 模型的扩展版本用于右删失、时间相关的协变量。这是我尝试过的,遵循关于时间相关协变量的小插图 https://cran.microsoft.com/web/packages/survival/vignettes/timedep.pdf(第 3.4 节):
library(survival)
library(mlr)
data(pbc)
temp <- subset(pbc, id <= 312, select=c(id:sex, stage)) # baseline
pbc2 <- tmerge(temp, temp, id=id, death = event(time, status)) #set range
pbc2 <- tmerge(pbc2, pbcseq, id=id, ascites = tdc(day, ascites),
bili = tdc(day, bili), albumin = tdc(day, albumin),
protime = tdc(day, protime), alk.phos = tdc(day, alk.phos))
pbc.task <- makeSurvTask(data = pbc2, target = c("tstart", "tstop", "status"))
cox.lrn <- makeLearner(cl="surv.coxph", predict.type="response")
mod = train(cox.lrn, pbc.task)
当我创建任务时,我收到以下错误消息:
Error in makeSurvTask(data = pbc2, target = c("tstart", "tstop", "status")) :
Assertion on 'target' failed: Must have length 2, but has length 3.
所以很明显我不能将 tstart 和 tstop 都传递给 makeSurvTask。有什么方法可以在 mlr 中将时间相关变量与 cox 模型一起使用?
mlr 教程表明可以使用区间删失数据:
Survival tasks use two target columns. For left and right censored problems
these consist of the survival time and a binary event indicator. For interval
censored data the two target columns must be specified in the "interval2"
format (see survival::Surv()).
是否可以将 interval2 格式用于与时间相关的数据?如果是这样,这将如何完成?