Create a cutting test function for use with sim_gs_n()
Arguments
- test
A test function such as
wlr()
,maxcombo()
, orrmst()
- ...
Arguments passed to the cutting test function
Examples
# Simulate trial data
trial_data <- sim_pw_surv()
# Cut after 150 events
trial_data_cut <- cut_data_by_event(trial_data, 150)
# Create a cutting test function that can be used by sim_gs_n()
regular_logrank_test <- create_test(wlr, weight = fh(rho = 0, gamma = 0))
# Test the cutting
regular_logrank_test(trial_data_cut)
#> $method
#> [1] "WLR"
#>
#> $parameter
#> [1] "FH(rho=0, gamma=0)"
#>
#> $estimate
#> [1] -15.13998
#>
#> $se
#> [1] 4.428528
#>
#> $z
#> [1] 3.418739
#>
#> $info
#> [1] 23.45745
#>
#> $info0
#> [1] 23.5
#>
# The results are the same as directly calling the function
stopifnot(all.equal(
regular_logrank_test(trial_data_cut),
wlr(trial_data_cut, weight = fh(rho = 0, gamma = 0))
))