This function censors a study after a pre-specified number of events occurred.
Arguments
- data
(
data.frame
)
illness-death data set in1rowPatient
format.- eventNum
(
int
)
number of events.- typeEvent
(
string
)
type of event. Possible values arePFS
andOS
.
Value
This function returns a data set that is censored after eventNum
of
typeEvent
-events occurred.
Examples
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)
censoringByNumberEvents(data = simStudyWide, eventNum = 20, typeEvent = "PFS")
#> id trt PFStime PFSevent OStime CensoredOS OSevent recruitTime
#> 1 1 1 0.29751960 1 0.29751960 0 1 0.04517520
#> 2 2 1 0.12513894 1 0.54624044 0 1 0.26554857
#> 3 3 1 0.49792717 1 0.49792717 0 1 2.07153825
#> 4 5 1 0.27160138 1 0.27160138 0 1 0.04712055
#> 5 7 1 0.01297705 1 0.01297705 0 1 2.31169178
#> 6 8 1 0.03330278 1 0.10455802 0 1 1.89845412
#> 7 9 1 0.03270915 1 0.22374433 0 1 2.52109845
#> 8 10 1 0.41109532 1 0.41109532 0 1 0.41170454
#> 9 11 1 0.11409741 1 0.11409741 0 1 2.43969680
#> 10 14 1 0.18720833 1 0.18720833 0 1 1.14154604
#> 11 17 1 0.10301071 0 0.10301071 1 0 2.80318332
#> 12 18 1 0.53709000 1 1.29772311 0 1 0.29178983
#> 13 19 1 0.12296926 1 0.12296926 0 1 2.36188524
#> 14 25 2 1.37601037 1 2.24317229 1 0 0.66302174
#> 15 26 2 0.25009033 1 0.25009033 0 1 2.40751718
#> 16 27 2 0.17169190 1 0.83066636 0 1 1.11791628
#> 17 28 2 0.10339521 1 0.10339521 0 1 2.06612613
#> 18 29 2 0.05870449 1 0.28657794 0 1 2.06008296
#> 19 31 2 0.71155991 1 0.71155991 0 1 1.02311548
#> 20 33 2 0.15334548 1 0.19521458 1 0 2.71097945
#> 21 39 2 0.02897126 1 0.02897126 0 1 2.87722277
#> OStimeCal PFStimeCal
#> 1 0.3426948 0.3426948
#> 2 0.8117890 0.3906875
#> 3 2.5694654 2.5694654
#> 4 0.3187219 0.3187219
#> 5 2.3246688 2.3246688
#> 6 2.0030121 1.9317569
#> 7 2.7448428 2.5538076
#> 8 0.8227999 0.8227999
#> 9 2.5537942 2.5537942
#> 10 1.3287544 1.3287544
#> 11 2.9061940 2.9061940
#> 12 1.5895129 0.8288798
#> 13 2.4848545 2.4848545
#> 14 2.9061940 2.0390321
#> 15 2.6576075 2.6576075
#> 16 1.9485826 1.2896082
#> 17 2.1695213 2.1695213
#> 18 2.3466609 2.1187875
#> 19 1.7346754 1.7346754
#> 20 2.9061940 2.8643249
#> 21 2.9061940 2.9061940