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.19523586 0 1 1.4550634
#> 2 0.35080766 0 1 0.4902721
#> 3 0.34149957 0 1 1.3088823
#> 4 0.89146418 1 0 5.0000000
#> 5 0.85707860 0 1 3.7131997
#> 6 1.01247538 1 0 5.0000000
#> 7 0.40785972 1 0 5.0000000
#> 8 0.84135983 0 1 4.9941591
#> 9 0.28230584 0 1 1.0046759
#> 10 0.75107341 0 1 2.6480201
#> 11 1.26468959 0 1 2.3579511
#> 12 0.73355273 1 0 5.0000000
#> 13 1.81819078 0 1 2.4158313
#> 14 0.13958065 1 0 5.0000000
#> 15 0.09935093 0 1 0.4885696
#> 16 0.36663700 0 1 2.1858942
#> 17 0.79667126 0 1 4.7932430
#> 18 0.08515286 0 1 1.9478422
#> 19 0.81168431 0 1 2.4254459
#> 20 0.41184153 0 1 0.9099192
#> 21 0.04203146 0 1 1.1677460
#> 22 0.60235971 0 1 0.6773623
#> 23 0.03622457 1 0 5.0000000
#> 24 0.99228401 0 1 1.9429321
#> 25 0.33535496 0 1 0.7510474
#> 26 0.04945620 0 1 1.1622375
#> 27 0.23404850 0 1 4.4707196
#> 28 0.60577775 0 1 0.6320724
#> 29 0.55861252 0 1 2.3830228
#> 30 1.10401590 1 0 5.0000000
#> 31 0.61858280 0 1 4.4282845
#> 32 0.16964470 0 1 2.2380411