If I try to use as_ped to build my competing risks data set with time dependent covariates, the follow up time is cut short at the last event time where status == 1L and any events for status > 1L (as well as censoring after that time, status == 0L) are ignored.
Example:
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"
)
max(ped_dat$tend)
Returns [1] 70 when it should return 100.
If I try to use
as_pedto build my competing risks data set with time dependent covariates, the follow up time is cut short at the last event time wherestatus == 1Land any events forstatus > 1L(as well as censoring after that time,status == 0L) are ignored.Example:
Returns
[1] 70when it should return 100.