Censors follow-up at a specified calendar time and aggregates events per subject. Returns one row per subject randomized before the cut date, with the total number of observed events and the truncated follow-up time (adjusted for any event gaps).
Arguments
- data
Data generated by
nb_sim().- cut_date
Calendar time (relative to trial start) at which to censor follow-up.
- event_gap
Gap duration after each event during which no new events are counted. Can be a numeric value (default
5 / 365.25) or a function returning a numeric value. The time at risk is reduced by the sum of these gaps (truncated by the cut date).- ...
Additional arguments passed to methods.
Value
A data frame with one row per subject randomized prior to cut_date containing
the truncated follow-up time (tte) and total number of observed events (events).
Examples
enroll_rate <- data.frame(rate = 20 / (5 / 12), duration = 5 / 12)
fail_rate <- data.frame(treatment = c("Control", "Experimental"), rate = c(0.5, 0.3))
dropout_rate <- data.frame(
treatment = c("Control", "Experimental"),
rate = c(0.1, 0.05), duration = c(100, 100)
)
sim <- nb_sim(enroll_rate, fail_rate, dropout_rate, max_followup = 2, n = 20)
cut_data_by_date(sim, cut_date = 1)
#> id treatment enroll_time tte events
#> 1 1 Control 0.02287797 0.3399344 1
#> 2 2 Experimental 0.03279845 0.9535123 1
#> 3 3 Experimental 0.03964368 0.9466671 1
#> 4 4 Control 0.09054028 0.3342787 1
#> 5 5 Experimental 0.09165196 0.9083480 0
#> 6 6 Control 0.13854364 0.8614564 0
#> 7 7 Experimental 0.14631736 0.8536826 0
#> 8 8 Control 0.18163569 0.8183643 0
#> 9 9 Experimental 0.18628345 0.8137165 0
#> 10 10 Experimental 0.18773699 0.7985738 1
#> 11 11 Control 0.19327308 0.8067269 0
#> 12 12 Control 0.19373652 0.8062635 0
#> 13 13 Experimental 0.19677352 0.8032265 0
#> 14 14 Experimental 0.26004958 0.7399504 0
#> 15 15 Control 0.26358648 0.7364135 0
#> 16 16 Control 0.28121348 0.7187865 0
#> 17 17 Experimental 0.28548428 0.7145157 0
#> 18 18 Control 0.28922751 0.2934168 1
#> 19 19 Experimental 0.30002577 0.6999742 0
#> 20 20 Control 0.31402891 0.6722818 1