Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jonas-schropp opened this issue May 6, 2022 · 1 comment
Open

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

jonas-schropp opened this issue May 6, 2022 · 1 comment

Comments

@jonas-schropp
Copy link

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~
@adibender
Copy link
Owner

Thx, I can confirm. There also appears to be another problem. For the 2nd cause the TDC values don't appear to be correct...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants