Skip to content

combine argument in as_ped ignored when tdc's are present #219

Description

@jonas-schropp

If I try to transform a competing risk data set with time-dependent covariates into ped format, the combine argument is ignored. See example below:

library(pammtools)

dat <- data.frame(
  id = factor(1:10),
  status = c(0L, 1L, 2L, 0L, 1L, 2L, 1L, 0L, 0L, 2L),
  time = seq(from = 10, to = 100, by = 10)
)

tdcs <- data.frame(
  id = factor(c(1:10, 1:10)),
  var = rbinom(20, 1, 0.3),
  tt = c(rep(0, 10), seq(5, 23, 2))
)

ped_dat <- as_ped(
  data = list(dat, tdcs),
  formula = Surv(time, status) ~ concurrent(var, tz_var = "tt"), 
  id = "id",
  combine = FALSE
)

dplyr::glimpse(ped_dat)

Result:

Rows: 228
Columns: 8
$ id         <fct> 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2~
$ tstart     <dbl> 0, 5, 7, 9, 0, 5, 7, 9, 11, 13,~
$ tend       <dbl> 5, 7, 9, 11, 5, 7, 9, 11, 13, 1~
$ interval   <fct> "(0,5]", "(5,7]", "(7,9]", "(9,~
$ offset     <dbl> 1.6094379, 0.6931472, 0.6931472~
$ ped_status <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
$ cause      <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1~
$ var        <int> 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0~

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions