我正在使用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格式用于与时间相关的数据?如果是这样,该怎么办?