MLR - Survival analysis with time-dependent data

2019-08-02 21:31发布

I am using mlr and would like to be able to use the extended version of the Cox PH model for right-censored, time dependent covariates. This is what I have tried, following the vignette on time-dependent covariates https://cran.microsoft.com/web/packages/survival/vignettes/timedep.pdf (section 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)

When I create the task I get the following error message:

Error in makeSurvTask(data = pbc2, target = c("tstart", "tstop", "status")) : 
  Assertion on 'target' failed: Must have length 2, but has length 3.

So obviously I cannot pass both tstart and tstop to makeSurvTask. Is there any way to use time-dependent variables with the cox model in mlr?

The mlr tutorial indicates that using interval censored data is possible:

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()).

Is it possible to use the interval2 format for time-dependent data? If so, how would this be done?

0条回答
登录 后发表回答