diff --git a/DESCRIPTION b/DESCRIPTION index 41845a26..eef6c513 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: simtrial Type: Package Title: Clinical Trial Simulation -Version: 0.3.2.13 +Version: 0.3.2.14 Authors@R: c( person("Keaven", "Anderson", email = "keaven_anderson@merck.com", role = c("aut")), person("Yilong", "Zhang", email = "elong0527@gmail.com", role = c("aut")), diff --git a/NAMESPACE b/NAMESPACE index 4f6b6de3..56f69159 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,8 +1,8 @@ # Generated by roxygen2: do not edit by hand export(counting_process) -export(create_cutting) -export(create_cutting_test) +export(create_cut) +export(create_test) export(cut_data_by_date) export(cut_data_by_event) export(early_zero) diff --git a/R/sim_gs_n.R b/R/sim_gs_n.R index 8f0fddb1..863a7c5f 100644 --- a/R/sim_gs_n.R +++ b/R/sim_gs_n.R @@ -22,17 +22,19 @@ #' arguments will change as we add additional features. #' #' @inheritParams sim_fixed_n -#' @param test A test function such as [wlr()], [maxcombo()], or [rmst()]. The -#' simulated data set is passed as the first positional argument to the test -#' function provided. Alternatively a list of functions created by -#' [create_cutting_test()]. The list form is experimental and currently -#' limited. It only accepts one test per cutting (in the future multiple tests -#' may be accepted), and all the tests must consistently return the same exact -#' results (again this may be more flexible in the future). -#' @param cutting A list of cutting functions created by [create_cutting()], -#' see examples. +#' @param test One or more test functions such as [wlr()], [maxcombo()], or +#' [rmst()]. If a single test function is provided, it will be applied at each +#' cut. Alternatively a list of functions created by [create_test()]. The list +#' form is experimental and currently limited. It only accepts one test per +#' cutting (in the future multiple tests may be accepted), and all the tests +#' must consistently return the same exact results (again this may be more +#' flexible in the future). Importantly, note that the simulated data set is +#' always passed as the first positional argument to each test function +#' provided. +#' @param cut A list of cutting functions created by [create_cut()], see +#' examples. #' @param seed Random seed. -#' @param ... Arguments passed to the test function provided by the argument +#' @param ... Arguments passed to the test function(s) provided by the argument #' `test`. #' #' @return A data frame summarizing the simulation ID, analysis date, @@ -79,7 +81,7 @@ #' # - At least 20 months have elapsed after enrolling 200/400 subjects, with a #' # minimum of 20 months follow-up. #' # However, if events accumulation is slow, we will wait for a maximum of 24 months. -#' ia1 <- create_cutting( +#' ia1 <- create_cut( #' planned_calendar_time = 20, #' target_event_overall = 100, #' max_extension_for_target_event = 24, @@ -93,7 +95,7 @@ #' # - At least 250 events have occurred. #' # - At least 10 months after IA1. #' # However, if events accumulation is slow, we will wait for a maximum of 34 months. -#' ia2 <- create_cutting( +#' ia2 <- create_cut( #' planned_calendar_time = 32, #' target_event_overall = 200, #' max_extension_for_target_event = 34, @@ -104,7 +106,7 @@ #' # The final analysis will occur at the later of the following 2 conditions: #' # - At least 45 months have passed since the start of the study. #' # - At least 300 events have occurred. -#' fa <- create_cutting( +#' fa <- create_cut( #' planned_calendar_time = 45, #' target_event_overall = 350 #' ) @@ -116,7 +118,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = fh(rho = 0, gamma = 0) #' ) @@ -128,7 +130,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = fh(rho = 0, gamma = 0.5) #' ) @@ -140,7 +142,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = mb(delay = 3) #' ) @@ -152,7 +154,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = early_zero(6) #' ) @@ -164,7 +166,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = rmst, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' tau = 20 #' ) @@ -176,7 +178,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = milestone, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' ms_time = 10 #' ) @@ -189,7 +191,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = maxcombo, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' rho = c(0, 0), #' gamma = c(0, 0.5) @@ -204,7 +206,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = maxcombo(test1 = wlr, test2 = milestone), -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' test1_par = list(weight = fh(rho = 0, gamma = 0.5)), #' test2_par = list(ms_time = 10) @@ -220,7 +222,7 @@ #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, #' test = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' test_par = list( #' ia1 = list(weight = fh(rho = 0, gamma = 0)), @@ -247,7 +249,7 @@ sim_gs_n <- function( ), block = rep(c("experimental", "control"), 2), test = wlr, - cutting = NULL, + cut = NULL, seed = 2024, ...) { # Input checking @@ -268,7 +270,7 @@ sim_gs_n <- function( ) # Initialize the cut date of IA(s) and FA - n_analysis <- length(cutting) + n_analysis <- length(cut) cut_date <- rep(-100, n_analysis) ans_1sim <- NULL @@ -278,14 +280,14 @@ sim_gs_n <- function( test <- vector(mode = "list", length = n_analysis) test[] <- list(test_single) } - if (length(test) != length(cutting)) { + if (length(test) != length(cut)) { stop("If you want to run different tests at each cutting, the list of tests must be the same length as the list of cuttings") } for (i_analysis in seq_len(n_analysis)) { # Get cut date - cut_date[i_analysis] <- cutting[[i_analysis]](simu_data) + cut_date[i_analysis] <- cut[[i_analysis]](simu_data) # Cut the data simu_data_cut <- simu_data |> cut_data_by_date(cut_date[i_analysis]) @@ -327,14 +329,14 @@ sim_gs_n <- function( #' # Create a cutting function that applies the following 2 conditions: #' # - At least 45 months have passed since the start of the study #' # - At least 300 events have occurred -#' cutting <- create_cutting( +#' cutting <- create_cut( #' planned_calendar_time = 45, #' target_event_overall = 350 #' ) #' #' # Cut the trial data #' cutting(trial_data) -create_cutting <- function(...) { +create_cut <- function(...) { function(data) { get_analysis_date(data, ...) } @@ -352,7 +354,7 @@ create_cutting <- function(...) { #' #' @export #' -#' @seealso [sim_gs_n()], [create_cutting()] +#' @seealso [sim_gs_n()], [create_cut()] #' #' @examples #' # Simulate trial data @@ -362,7 +364,7 @@ create_cutting <- function(...) { #' 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_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) +#' regular_logrank_test <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) #' #' # Test the cutting #' regular_logrank_test(trial_data_cut) @@ -372,7 +374,7 @@ create_cutting <- function(...) { #' regular_logrank_test(trial_data_cut), #' wlr(trial_data_cut, weight = fh(rho = 0, gamma = 0)) #' )) -create_cutting_test <- function(test, ...) { +create_test <- function(test, ...) { stopifnot(is.function(test)) function(data) { test(data, ...) @@ -386,7 +388,7 @@ create_cutting_test <- function(test, ...) { #' features. #' #' @param data Trial data cut by [cut_data_by_event()] or [cut_data_by_date()] -#' @param ... One or more test functions. Use [create_cutting_test()] to change +#' @param ... One or more test functions. Use [create_test()] to change #' the default arguments of each test function. #' #' @return A list of test results, one per test. If the test functions are named @@ -394,16 +396,16 @@ create_cutting_test <- function(test, ...) { #' #' @export #' -#' @seealso [create_cutting_test()] +#' @seealso [create_test()] #' #' @examples #' trial_data <- sim_pw_surv(n = 200) #' trial_data_cut <- cut_data_by_event(trial_data, 150) #' #' # create cutting test functions -#' wlr_partial <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) -#' rmst_partial <- create_cutting_test(rmst, tau = 20) -#' maxcombo_partial <- create_cutting_test(maxcombo, rho = c(0, 0), gamma = c(0, 0.5)) +#' wlr_partial <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) +#' rmst_partial <- create_test(rmst, tau = 20) +#' maxcombo_partial <- create_test(maxcombo, rho = c(0, 0), gamma = c(0, 0.5)) #' #' multitest( #' data = trial_data_cut, diff --git a/_pkgdown.yml b/_pkgdown.yml index bc86c907..4fb8c360 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -43,7 +43,7 @@ reference: - cut_data_by_event - get_cut_date_by_event - get_analysis_date - - create_cutting + - create_cut - title: "Compute p-values/test statistics" contents: @@ -53,7 +53,7 @@ reference: - milestone - wlr - maxcombo - - create_cutting_test + - create_test - multitest - title: "Randomization algorithms" diff --git a/man/create_cutting.Rd b/man/create_cut.Rd similarity index 90% rename from man/create_cutting.Rd rename to man/create_cut.Rd index de090b54..bcb7b6cb 100644 --- a/man/create_cutting.Rd +++ b/man/create_cut.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/sim_gs_n.R -\name{create_cutting} -\alias{create_cutting} +\name{create_cut} +\alias{create_cut} \title{Create a cutting function} \usage{ -create_cutting(...) +create_cut(...) } \arguments{ \item{...}{Arguments passed to \code{\link[=get_analysis_date]{get_analysis_date()}}} @@ -23,7 +23,7 @@ trial_data <- sim_pw_surv() # Create a cutting function that applies the following 2 conditions: # - At least 45 months have passed since the start of the study # - At least 300 events have occurred -cutting <- create_cutting( +cutting <- create_cut( planned_calendar_time = 45, target_event_overall = 350 ) diff --git a/man/create_cutting_test.Rd b/man/create_test.Rd similarity index 79% rename from man/create_cutting_test.Rd rename to man/create_test.Rd index 62eb66bf..7f0a1c4d 100644 --- a/man/create_cutting_test.Rd +++ b/man/create_test.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/sim_gs_n.R -\name{create_cutting_test} -\alias{create_cutting_test} +\name{create_test} +\alias{create_test} \title{Create a cutting test function} \usage{ -create_cutting_test(test, ...) +create_test(test, ...) } \arguments{ \item{test}{A test function such as \code{\link[=wlr]{wlr()}}, \code{\link[=maxcombo]{maxcombo()}}, or \code{\link[=rmst]{rmst()}}} @@ -26,7 +26,7 @@ trial_data <- sim_pw_surv() 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_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) +regular_logrank_test <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) # Test the cutting regular_logrank_test(trial_data_cut) @@ -38,5 +38,5 @@ stopifnot(all.equal( )) } \seealso{ -\code{\link[=sim_gs_n]{sim_gs_n()}}, \code{\link[=create_cutting]{create_cutting()}} +\code{\link[=sim_gs_n]{sim_gs_n()}}, \code{\link[=create_cut]{create_cut()}} } diff --git a/man/multitest.Rd b/man/multitest.Rd index 835a0d2b..31c8b06b 100644 --- a/man/multitest.Rd +++ b/man/multitest.Rd @@ -9,7 +9,7 @@ multitest(data, ...) \arguments{ \item{data}{Trial data cut by \code{\link[=cut_data_by_event]{cut_data_by_event()}} or \code{\link[=cut_data_by_date]{cut_data_by_date()}}} -\item{...}{One or more test functions. Use \code{\link[=create_cutting_test]{create_cutting_test()}} to change +\item{...}{One or more test functions. Use \code{\link[=create_test]{create_test()}} to change the default arguments of each test function.} } \value{ @@ -26,9 +26,9 @@ trial_data <- sim_pw_surv(n = 200) trial_data_cut <- cut_data_by_event(trial_data, 150) # create cutting test functions -wlr_partial <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) -rmst_partial <- create_cutting_test(rmst, tau = 20) -maxcombo_partial <- create_cutting_test(maxcombo, rho = c(0, 0), gamma = c(0, 0.5)) +wlr_partial <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) +rmst_partial <- create_test(rmst, tau = 20) +maxcombo_partial <- create_test(maxcombo, rho = c(0, 0), gamma = c(0, 0.5)) multitest( data = trial_data_cut, @@ -38,5 +38,5 @@ multitest( ) } \seealso{ -\code{\link[=create_cutting_test]{create_cutting_test()}} +\code{\link[=create_test]{create_test()}} } diff --git a/man/sim_gs_n.Rd b/man/sim_gs_n.Rd index 38538351..06939310 100644 --- a/man/sim_gs_n.Rd +++ b/man/sim_gs_n.Rd @@ -13,7 +13,7 @@ sim_gs_n( 18), hr = c(0.9, 0.6), dropout_rate = rep(0.001, 2)), block = rep(c("experimental", "control"), 2), test = wlr, - cutting = NULL, + cut = NULL, seed = 2024, ... ) @@ -36,20 +36,22 @@ for experimental vs. control, and dropout rates by stratum and time period.} \item{block}{As in \code{\link[=sim_pw_surv]{sim_pw_surv()}}. Vector of treatments to be included in each block.} -\item{test}{A test function such as \code{\link[=wlr]{wlr()}}, \code{\link[=maxcombo]{maxcombo()}}, or \code{\link[=rmst]{rmst()}}. The -simulated data set is passed as the first positional argument to the test -function provided. Alternatively a list of functions created by -\code{\link[=create_cutting_test]{create_cutting_test()}}. The list form is experimental and currently -limited. It only accepts one test per cutting (in the future multiple tests -may be accepted), and all the tests must consistently return the same exact -results (again this may be more flexible in the future).} +\item{test}{One or more test functions such as \code{\link[=wlr]{wlr()}}, \code{\link[=maxcombo]{maxcombo()}}, or +\code{\link[=rmst]{rmst()}}. If a single test function is provided, it will be applied at each +cut. Alternatively a list of functions created by \code{\link[=create_test]{create_test()}}. The list +form is experimental and currently limited. It only accepts one test per +cutting (in the future multiple tests may be accepted), and all the tests +must consistently return the same exact results (again this may be more +flexible in the future). Importantly, note that the simulated data set is +always passed as the first positional argument to each test function +provided.} -\item{cutting}{A list of cutting functions created by \code{\link[=create_cutting]{create_cutting()}}, -see examples.} +\item{cut}{A list of cutting functions created by \code{\link[=create_cut]{create_cut()}}, see +examples.} \item{seed}{Random seed.} -\item{...}{Arguments passed to the test function provided by the argument +\item{...}{Arguments passed to the test function(s) provided by the argument \code{test}.} } \value{ @@ -99,7 +101,7 @@ ratio <- 1 # Randomization ratio (experimental:control) # - At least 20 months have elapsed after enrolling 200/400 subjects, with a # minimum of 20 months follow-up. # However, if events accumulation is slow, we will wait for a maximum of 24 months. -ia1 <- create_cutting( +ia1 <- create_cut( planned_calendar_time = 20, target_event_overall = 100, max_extension_for_target_event = 24, @@ -113,7 +115,7 @@ ia1 <- create_cutting( # - At least 250 events have occurred. # - At least 10 months after IA1. # However, if events accumulation is slow, we will wait for a maximum of 34 months. -ia2 <- create_cutting( +ia2 <- create_cut( planned_calendar_time = 32, target_event_overall = 200, max_extension_for_target_event = 34, @@ -124,7 +126,7 @@ ia2 <- create_cutting( # The final analysis will occur at the later of the following 2 conditions: # - At least 45 months have passed since the start of the study. # - At least 300 events have occurred. -fa <- create_cutting( +fa <- create_cut( planned_calendar_time = 45, target_event_overall = 350 ) @@ -136,7 +138,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = fh(rho = 0, gamma = 0) ) @@ -148,7 +150,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = fh(rho = 0, gamma = 0.5) ) @@ -160,7 +162,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = mb(delay = 3) ) @@ -172,7 +174,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = early_zero(6) ) @@ -184,7 +186,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = rmst, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, tau = 20 ) @@ -196,7 +198,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = milestone, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, ms_time = 10 ) @@ -209,7 +211,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = maxcombo, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, rho = c(0, 0), gamma = c(0, 0.5) @@ -224,7 +226,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = maxcombo(test1 = wlr, test2 = milestone), - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, test1_par = list(weight = fh(rho = 0, gamma = 0.5)), test2_par = list(ms_time = 10) @@ -240,7 +242,7 @@ sim_gs_n( enroll_rate = enroll_rate, fail_rate = fail_rate, test = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, test_par = list( ia1 = list(weight = fh(rho = 0, gamma = 0)), diff --git a/tests/testthat/helper-sim_gs_n.R b/tests/testthat/helper-sim_gs_n.R index 49828a54..70f9a8b2 100644 --- a/tests/testthat/helper-sim_gs_n.R +++ b/tests/testthat/helper-sim_gs_n.R @@ -42,7 +42,7 @@ test_cutting <- function() { # - At least 20 months have elapsed after enrolling 200/400 subjects, with a # minimum of 20 months follow-up # However, if events accumulation is slow, we will wait for a maximum of 24 months. - ia1 <- create_cutting( + ia1 <- create_cut( planned_calendar_time = 20, target_event_overall = 100, max_extension_for_target_event = 24, @@ -55,7 +55,7 @@ test_cutting <- function() { # - At least 250 events have occurred # - At least 10 months after IA1 # However, if events accumulation is slow, we will wait for a maximum of 34 months. - ia2 <- create_cutting( + ia2 <- create_cut( planned_calendar_time = 32, target_event_overall = 200, max_extension_for_target_event = 34, @@ -65,7 +65,7 @@ test_cutting <- function() { # The final analysis will occur at the later of the following 2 conditions: # - At least 45 months have passed since the start of the study # - At least 300 events have occurred - fa <- create_cutting( + fa <- create_cut( planned_calendar_time = 45, target_event_overall = 350 ) diff --git a/tests/testthat/test-unvalidated-multitest.R b/tests/testthat/test-unvalidated-multitest.R index d5bd7841..470aedd2 100644 --- a/tests/testthat/test-unvalidated-multitest.R +++ b/tests/testthat/test-unvalidated-multitest.R @@ -3,9 +3,9 @@ test_that("multitest() is equivalent to running tests individually", { trial_data_cut <- cut_data_by_event(trial_data, 150) # create cutting test functions - wlr_partial <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) - rmst_partial <- create_cutting_test(rmst, tau = 20) - maxcombo_partial <- create_cutting_test(maxcombo, rho = c(0, 0), gamma = c(0, 0.5)) + wlr_partial <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) + rmst_partial <- create_test(rmst, tau = 20) + maxcombo_partial <- create_test(maxcombo, rho = c(0, 0), gamma = c(0, 0.5)) observed <- multitest( data = trial_data_cut, diff --git a/tests/testthat/test-unvalidated-sim_gs_n.R b/tests/testthat/test-unvalidated-sim_gs_n.R index 80bc742a..241e237a 100644 --- a/tests/testthat/test-unvalidated-sim_gs_n.R +++ b/tests/testthat/test-unvalidated-sim_gs_n.R @@ -10,7 +10,7 @@ test_that("Test 1: regular logrank test", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = wlr, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, weight = fh(rho = 0, gamma = 0) ) @@ -38,7 +38,7 @@ test_that("Test 2: weighted logrank test by FH(0, 0.5)", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = wlr, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, weight = fh(rho = 0, gamma = 0.5) ) @@ -66,7 +66,7 @@ test_that("Test 3: weighted logrank test by MB(3)", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = wlr, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, weight = mb(delay = 3) ) @@ -92,7 +92,7 @@ test_that("Test 4: weighted logrank test by early zero (6)", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = wlr, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, weight = early_zero(6) ) @@ -118,7 +118,7 @@ test_that("Test 5: RMST", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = rmst, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, tau = 20 ) @@ -159,7 +159,7 @@ test_that("Test 6: Milestone", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = milestone, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, ms_time = 10 ) @@ -212,7 +212,7 @@ test_that("Test 7: MaxCombo (WLR-FH(0,0) + WLR-FH(0, 0.5))", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = maxcombo, - cutting = test_cutting(), + cut = test_cutting(), seed = 2024, rho = c(0, 0), gamma = c(0, 0.5) @@ -233,9 +233,9 @@ test_that("Test 7: MaxCombo (WLR-FH(0,0) + WLR-FH(0, 0.5))", { }) test_that("sim_gs_n() accepts different tests per cutting", { - wlr_cut1 <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) - wlr_cut2 <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0.5)) - wlr_cut3 <- create_cutting_test(wlr, weight = fh(rho = 0.5, gamma = 0)) + wlr_cut1 <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) + wlr_cut2 <- create_test(wlr, weight = fh(rho = 0, gamma = 0.5)) + wlr_cut3 <- create_test(wlr, weight = fh(rho = 0.5, gamma = 0)) observed <- sim_gs_n( n_sim = 3, @@ -243,7 +243,7 @@ test_that("sim_gs_n() accepts different tests per cutting", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = list(wlr_cut1, wlr_cut2, wlr_cut3), - cutting = test_cutting(), + cut = test_cutting(), seed = 2024 ) expected <- data.frame( @@ -264,8 +264,8 @@ test_that("sim_gs_n() accepts different tests per cutting", { }) test_that("sim_gs_n() requires a test for each cutting", { - wlr_cut1 <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0)) - wlr_cut2 <- create_cutting_test(wlr, weight = fh(rho = 0, gamma = 0.5)) + wlr_cut1 <- create_test(wlr, weight = fh(rho = 0, gamma = 0)) + wlr_cut2 <- create_test(wlr, weight = fh(rho = 0, gamma = 0.5)) expect_error( sim_gs_n( @@ -274,7 +274,7 @@ test_that("sim_gs_n() requires a test for each cutting", { enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), test = list(wlr_cut1, wlr_cut2), - cutting = test_cutting(), + cut = test_cutting(), seed = 2024 ), "If you want to run different tests at each cutting"