This function censors a study after a pre-specified number of events occurred.
censoringByNumberEvents(data, eventNum, typeEvent)
(data.frame
)
illness-death data set in 1rowPatient
format.
(int
)
number of events.
(string
)
type of event. Possible values are PFS
and OS
.
This function returns a data set that is censored after eventNum
of
typeEvent
-events occurred.
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 4 1 0.6099896446 1 0.757117047 1 0 2.9732209
#> 2 5 1 0.2196439320 1 1.608989991 0 1 0.1379544
#> 3 6 1 0.9735937420 1 0.973593742 0 1 2.6522382
#> 4 8 1 0.0007249124 1 0.608592573 0 1 1.3130382
#> 5 9 1 0.1476712695 1 0.147671269 0 1 0.6245903
#> 6 10 1 0.2172866438 1 0.217286644 0 1 3.2920787
#> 7 12 1 0.0697977619 1 0.438450060 0 1 0.2555085
#> 8 14 1 0.0428412492 1 0.537508873 1 0 3.1928291
#> 9 15 1 0.8659055809 1 1.672215157 1 0 2.0581228
#> 10 16 1 0.0757965483 1 0.075796548 0 1 3.4623818
#> 11 20 1 0.5023043571 1 0.502304357 0 1 1.6043001
#> 12 21 2 0.1740500895 0 0.174050090 1 0 3.5562879
#> 13 22 2 0.0070729371 1 0.007072937 0 1 3.6633501
#> 14 23 2 0.0968432583 1 0.096843258 0 1 1.8063394
#> 15 25 2 0.2843334709 1 0.284333471 0 1 2.2641496
#> 16 27 2 0.2519173844 1 0.251917384 0 1 0.2851898
#> 17 28 2 0.4790230872 1 0.479023087 1 0 3.2513149
#> 18 30 2 0.2710699625 1 0.271069963 0 1 2.0685871
#> 19 31 2 0.1877215692 1 0.207519437 0 1 1.1860090
#> 20 35 2 0.0068587353 1 0.006858735 0 1 0.9052675
#> 21 39 2 0.1414939958 1 0.141493996 0 1 1.1071277
#> 22 40 2 0.5349011487 0 0.534901149 1 0 3.1954368
#> OStimeCal PFStimeCal
#> 1 3.7303379 3.5832105
#> 2 1.7469443 0.3575983
#> 3 3.6258319 3.6258319
#> 4 1.9216308 1.3137631
#> 5 0.7722615 0.7722615
#> 6 3.5093653 3.5093653
#> 7 0.6939585 0.3253062
#> 8 3.7303379 3.2356703
#> 9 3.7303379 2.9240284
#> 10 3.5381784 3.5381784
#> 11 2.1066045 2.1066045
#> 12 3.7303379 3.7303379
#> 13 3.6704230 3.6704230
#> 14 1.9031827 1.9031827
#> 15 2.5484831 2.5484831
#> 16 0.5371072 0.5371072
#> 17 3.7303379 3.7303379
#> 18 2.3396570 2.3396570
#> 19 1.3935284 1.3737305
#> 20 0.9121262 0.9121262
#> 21 1.2486217 1.2486217
#> 22 3.7303379 3.7303379