Helper function for censoringByNumberEvents
getCensoredData(time, event, data)
(numeric
)
event times.
(numeric
)
event indicator.
(data.frame
)
data frame including patient id id
, recruiting time recruitTime
and individual censoring time censTimeInd
.
This function returns a data frame with columns: event time, censoring indicator, event indicator and event time in calendar time.
transition1 <- weibull_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6, p01 = 0.8, p02 = 0.9, p12 = 1)
transition2 <- weibull_transition(h01 = 1, h02 = 1.3, h12 = 1.7, p01 = 1.1, p02 = 0.9, p12 = 1.1)
simStudy <- getOneClinicalTrial(
nPat = c(20, 20), transitionByArm = list(transition1, transition2),
dropout = list(rate = 0.3, time = 10),
accrual = list(param = "time", value = 7)
)
simStudyWide <- getDatasetWideFormat(simStudy)
simStudyWide$censTimeInd <- 5 - simStudyWide$recruitTime
NotRecruited <- simStudyWide$id[simStudyWide$censTimeInd < 0]
censoredData <- simStudyWide[!(simStudyWide$id %in% NotRecruited), ]
getCensoredData(time = censoredData$OStime, event = censoredData$OSevent, data = censoredData)
#> time Censored event timeCal
#> 1 0.23396518 0 1 1.8656137
#> 2 0.54657521 0 1 3.8073518
#> 3 2.39133974 1 0 4.3929711
#> 4 0.32501792 1 0 5.0000000
#> 5 0.27211579 0 1 0.9484409
#> 6 0.17797641 0 1 2.0802284
#> 7 2.77784537 0 1 4.5399426
#> 8 0.10797672 1 0 5.0000000
#> 9 0.69790020 0 1 4.0053512
#> 10 0.12467862 0 1 2.7074363
#> 11 0.13644306 0 1 1.1246798
#> 12 0.11403424 0 1 3.1010187
#> 13 0.04788912 0 1 1.4999851
#> 14 0.03358482 0 1 2.0834607
#> 15 0.04596884 0 1 2.8679382
#> 16 0.05958641 0 1 1.2907290
#> 17 1.21404535 0 1 1.3638045
#> 18 0.86748030 0 1 1.8754755
#> 19 1.12834709 0 1 3.5811484
#> 20 0.40470574 0 1 1.1623839
#> 21 0.27994175 0 1 0.4931342
#> 22 0.03786377 1 0 5.0000000
#> 23 0.63692899 0 1 3.1258960
#> 24 0.34884560 0 1 0.3556521
#> 25 0.41836809 0 1 4.6971757
#> 26 1.06877649 0 1 2.8757720
#> 27 0.69560156 0 1 4.9222612
#> 28 0.43016117 0 1 2.8529454
#> 29 0.59675758 1 0 5.0000000