From b1083727e2055c793952b832342f14f63213c3fb Mon Sep 17 00:00:00 2001 From: John Blischak Date: Tue, 19 Mar 2024 16:01:57 -0400 Subject: [PATCH 1/5] Rename function factories create_cut() and create_test() --- NAMESPACE | 4 +- R/sim_gs_n.R | 104 +++++++++--------- _pkgdown.yml | 4 +- man/{create_cutting.Rd => create_cut.Rd} | 8 +- ...{create_cutting_test.Rd => create_test.Rd} | 10 +- man/multitest.Rd | 10 +- man/sim_gs_n.Rd | 68 ++++++------ tests/testthat/helper-sim_gs_n.R | 6 +- tests/testthat/test-unvalidated-multitest.R | 6 +- tests/testthat/test-unvalidated-sim_gs_n.R | 46 ++++---- 10 files changed, 135 insertions(+), 131 deletions(-) rename man/{create_cutting.Rd => create_cut.Rd} (90%) rename man/{create_cutting_test.Rd => create_test.Rd} (79%) 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..ff225b92 100644 --- a/R/sim_gs_n.R +++ b/R/sim_gs_n.R @@ -22,18 +22,20 @@ #' 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()], +#' @param tests 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 cuts 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 -#' `test`. +#' @param ... Arguments passed to the test function(s) provided by the argument +#' `tests`. #' #' @return A data frame summarizing the simulation ID, analysis date, #' z statistics or p-values. @@ -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 #' ) @@ -115,8 +117,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = wlr, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = fh(rho = 0, gamma = 0) #' ) @@ -127,8 +129,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = wlr, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = fh(rho = 0, gamma = 0.5) #' ) @@ -139,8 +141,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = wlr, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = mb(delay = 3) #' ) @@ -151,8 +153,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = wlr, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = wlr, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = early_zero(6) #' ) @@ -163,8 +165,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = rmst, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = rmst, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' tau = 20 #' ) @@ -175,8 +177,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = milestone, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = milestone, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' ms_time = 10 #' ) @@ -188,8 +190,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = maxcombo, -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = maxcombo, +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' rho = c(0, 0), #' gamma = c(0, 0.5) @@ -203,8 +205,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = maxcombo(test1 = wlr, test2 = milestone), -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = maxcombo(test1 = wlr, test2 = milestone), +#' cuts = 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) @@ -219,8 +221,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' test = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), -#' cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' tests = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), +#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' test_par = list( #' ia1 = list(weight = fh(rho = 0, gamma = 0)), @@ -246,8 +248,8 @@ sim_gs_n <- function( dropout_rate = rep(.001, 2) ), block = rep(c("experimental", "control"), 2), - test = wlr, - cutting = NULL, + tests = wlr, + cuts = NULL, seed = 2024, ...) { # Input checking @@ -268,30 +270,30 @@ sim_gs_n <- function( ) # Initialize the cut date of IA(s) and FA - n_analysis <- length(cutting) + n_analysis <- length(cuts) cut_date <- rep(-100, n_analysis) ans_1sim <- NULL # Organize tests for each cutting - if (is.function(test)) { - test_single <- test - test <- vector(mode = "list", length = n_analysis) - test[] <- list(test_single) + if (is.function(tests)) { + test_single <- tests + tests <- vector(mode = "list", length = n_analysis) + tests[] <- list(test_single) } - if (length(test) != length(cutting)) { + if (length(tests) != length(cuts)) { 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] <- cuts[[i_analysis]](simu_data) # Cut the data simu_data_cut <- simu_data |> cut_data_by_date(cut_date[i_analysis]) # Test - ans_1sim_new <- test[[i_analysis]](simu_data_cut, ...) + ans_1sim_new <- tests[[i_analysis]](simu_data_cut, ...) ans_1sim_new$analysis <- i_analysis ans_1sim_new$cut_date <- cut_date[i_analysis] ans_1sim_new$sim_id <- sim_id @@ -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..b5a57db4 100644 --- a/man/sim_gs_n.Rd +++ b/man/sim_gs_n.Rd @@ -12,8 +12,8 @@ sim_gs_n( fail_rate = data.frame(stratum = "All", duration = c(3, 100), fail_rate = log(2)/c(9, 18), hr = c(0.9, 0.6), dropout_rate = rep(0.001, 2)), block = rep(c("experimental", "control"), 2), - test = wlr, - cutting = NULL, + tests = wlr, + cuts = NULL, seed = 2024, ... ) @@ -36,21 +36,23 @@ 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{tests}{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()}}, +\item{cuts}{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 -\code{test}.} +\item{...}{Arguments passed to the test function(s) provided by the argument +\code{tests}.} } \value{ A data frame summarizing the simulation ID, analysis date, @@ -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 ) @@ -135,8 +137,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = wlr, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = fh(rho = 0, gamma = 0) ) @@ -147,8 +149,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = wlr, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = fh(rho = 0, gamma = 0.5) ) @@ -159,8 +161,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = wlr, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = mb(delay = 3) ) @@ -171,8 +173,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = wlr, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = wlr, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = early_zero(6) ) @@ -183,8 +185,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = rmst, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = rmst, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, tau = 20 ) @@ -195,8 +197,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = milestone, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = milestone, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, ms_time = 10 ) @@ -208,8 +210,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = maxcombo, - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = maxcombo, + cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, rho = c(0, 0), gamma = c(0, 0.5) @@ -223,8 +225,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = maxcombo(test1 = wlr, test2 = milestone), - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = maxcombo(test1 = wlr, test2 = milestone), + cuts = 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) @@ -239,8 +241,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - test = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), - cutting = list(ia1 = ia1, ia2 = ia2, fa = fa), + tests = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), + cuts = 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..0f5e192e 100644 --- a/tests/testthat/test-unvalidated-sim_gs_n.R +++ b/tests/testthat/test-unvalidated-sim_gs_n.R @@ -9,8 +9,8 @@ test_that("Test 1: regular logrank test", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = wlr, - cutting = test_cutting(), + tests = wlr, + cuts = test_cutting(), seed = 2024, weight = fh(rho = 0, gamma = 0) ) @@ -37,8 +37,8 @@ test_that("Test 2: weighted logrank test by FH(0, 0.5)", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = wlr, - cutting = test_cutting(), + tests = wlr, + cuts = test_cutting(), seed = 2024, weight = fh(rho = 0, gamma = 0.5) ) @@ -65,8 +65,8 @@ test_that("Test 3: weighted logrank test by MB(3)", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = wlr, - cutting = test_cutting(), + tests = wlr, + cuts = test_cutting(), seed = 2024, weight = mb(delay = 3) ) @@ -91,8 +91,8 @@ test_that("Test 4: weighted logrank test by early zero (6)", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = wlr, - cutting = test_cutting(), + tests = wlr, + cuts = test_cutting(), seed = 2024, weight = early_zero(6) ) @@ -117,8 +117,8 @@ test_that("Test 5: RMST", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = rmst, - cutting = test_cutting(), + tests = rmst, + cuts = test_cutting(), seed = 2024, tau = 20 ) @@ -158,8 +158,8 @@ test_that("Test 6: Milestone", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = milestone, - cutting = test_cutting(), + tests = milestone, + cuts = test_cutting(), seed = 2024, ms_time = 10 ) @@ -211,8 +211,8 @@ test_that("Test 7: MaxCombo (WLR-FH(0,0) + WLR-FH(0, 0.5))", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = maxcombo, - cutting = test_cutting(), + tests = maxcombo, + cuts = test_cutting(), seed = 2024, rho = c(0, 0), gamma = c(0, 0.5) @@ -233,17 +233,17 @@ 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, sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = list(wlr_cut1, wlr_cut2, wlr_cut3), - cutting = test_cutting(), + tests = list(wlr_cut1, wlr_cut2, wlr_cut3), + cuts = 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( @@ -273,8 +273,8 @@ test_that("sim_gs_n() requires a test for each cutting", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - test = list(wlr_cut1, wlr_cut2), - cutting = test_cutting(), + tests = list(wlr_cut1, wlr_cut2), + cuts = test_cutting(), seed = 2024 ), "If you want to run different tests at each cutting" From ada0b241c6758242b61c2e4e3bc728d0a4b656ce Mon Sep 17 00:00:00 2001 From: John Blischak Date: Fri, 22 Mar 2024 11:16:03 -0400 Subject: [PATCH 2/5] Use the singular `cut` and `test` for consistency in arg names --- R/sim_gs_n.R | 56 +++++++++++----------- man/sim_gs_n.Rd | 50 +++++++++---------- tests/testthat/test-unvalidated-sim_gs_n.R | 36 +++++++------- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/R/sim_gs_n.R b/R/sim_gs_n.R index ff225b92..d9b31123 100644 --- a/R/sim_gs_n.R +++ b/R/sim_gs_n.R @@ -117,8 +117,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = wlr, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = wlr, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = fh(rho = 0, gamma = 0) #' ) @@ -129,8 +129,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = wlr, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = wlr, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = fh(rho = 0, gamma = 0.5) #' ) @@ -141,8 +141,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = wlr, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = wlr, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = mb(delay = 3) #' ) @@ -153,8 +153,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = wlr, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = wlr, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' weight = early_zero(6) #' ) @@ -165,8 +165,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = rmst, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = rmst, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' tau = 20 #' ) @@ -177,8 +177,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = milestone, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = milestone, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' ms_time = 10 #' ) @@ -190,8 +190,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = maxcombo, -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = maxcombo, +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' rho = c(0, 0), #' gamma = c(0, 0.5) @@ -205,8 +205,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = maxcombo(test1 = wlr, test2 = milestone), -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = maxcombo(test1 = wlr, test2 = milestone), +#' 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) @@ -221,8 +221,8 @@ #' sample_size = 400, #' enroll_rate = enroll_rate, #' fail_rate = fail_rate, -#' tests = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), -#' cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), +#' test = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), +#' cut = list(ia1 = ia1, ia2 = ia2, fa = fa), #' seed = 2024, #' test_par = list( #' ia1 = list(weight = fh(rho = 0, gamma = 0)), @@ -248,8 +248,8 @@ sim_gs_n <- function( dropout_rate = rep(.001, 2) ), block = rep(c("experimental", "control"), 2), - tests = wlr, - cuts = NULL, + test = wlr, + cut = NULL, seed = 2024, ...) { # Input checking @@ -270,30 +270,30 @@ sim_gs_n <- function( ) # Initialize the cut date of IA(s) and FA - n_analysis <- length(cuts) + n_analysis <- length(cut) cut_date <- rep(-100, n_analysis) ans_1sim <- NULL # Organize tests for each cutting - if (is.function(tests)) { - test_single <- tests - tests <- vector(mode = "list", length = n_analysis) - tests[] <- list(test_single) + if (is.function(test)) { + test_single <- test + test <- vector(mode = "list", length = n_analysis) + test[] <- list(test_single) } - if (length(tests) != length(cuts)) { + 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] <- cuts[[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]) # Test - ans_1sim_new <- tests[[i_analysis]](simu_data_cut, ...) + ans_1sim_new <- test[[i_analysis]](simu_data_cut, ...) ans_1sim_new$analysis <- i_analysis ans_1sim_new$cut_date <- cut_date[i_analysis] ans_1sim_new$sim_id <- sim_id diff --git a/man/sim_gs_n.Rd b/man/sim_gs_n.Rd index b5a57db4..a9f28787 100644 --- a/man/sim_gs_n.Rd +++ b/man/sim_gs_n.Rd @@ -12,8 +12,8 @@ sim_gs_n( fail_rate = data.frame(stratum = "All", duration = c(3, 100), fail_rate = log(2)/c(9, 18), hr = c(0.9, 0.6), dropout_rate = rep(0.001, 2)), block = rep(c("experimental", "control"), 2), - tests = wlr, - cuts = NULL, + test = wlr, + cut = NULL, seed = 2024, ... ) @@ -36,6 +36,11 @@ 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{seed}{Random seed.} + +\item{...}{Arguments passed to the test function(s) provided by the argument +\code{tests}.} + \item{tests}{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 @@ -48,11 +53,6 @@ provided.} \item{cuts}{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(s) provided by the argument -\code{tests}.} } \value{ A data frame summarizing the simulation ID, analysis date, @@ -137,8 +137,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = wlr, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = wlr, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = fh(rho = 0, gamma = 0) ) @@ -149,8 +149,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = wlr, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = wlr, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = fh(rho = 0, gamma = 0.5) ) @@ -161,8 +161,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = wlr, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = wlr, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = mb(delay = 3) ) @@ -173,8 +173,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = wlr, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = wlr, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, weight = early_zero(6) ) @@ -185,8 +185,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = rmst, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = rmst, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, tau = 20 ) @@ -197,8 +197,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = milestone, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = milestone, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, ms_time = 10 ) @@ -210,8 +210,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = maxcombo, - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = maxcombo, + cut = list(ia1 = ia1, ia2 = ia2, fa = fa), seed = 2024, rho = c(0, 0), gamma = c(0, 0.5) @@ -225,8 +225,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = maxcombo(test1 = wlr, test2 = milestone), - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = maxcombo(test1 = wlr, test2 = milestone), + 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) @@ -241,8 +241,8 @@ sim_gs_n( sample_size = 400, enroll_rate = enroll_rate, fail_rate = fail_rate, - tests = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), - cuts = list(ia1 = ia1, ia2 = ia2, fa = fa), + test = list(ia1 = wlr, ia2 = wlr, fa = maxcombo), + 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/test-unvalidated-sim_gs_n.R b/tests/testthat/test-unvalidated-sim_gs_n.R index 0f5e192e..241e237a 100644 --- a/tests/testthat/test-unvalidated-sim_gs_n.R +++ b/tests/testthat/test-unvalidated-sim_gs_n.R @@ -9,8 +9,8 @@ test_that("Test 1: regular logrank test", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = wlr, - cuts = test_cutting(), + test = wlr, + cut = test_cutting(), seed = 2024, weight = fh(rho = 0, gamma = 0) ) @@ -37,8 +37,8 @@ test_that("Test 2: weighted logrank test by FH(0, 0.5)", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = wlr, - cuts = test_cutting(), + test = wlr, + cut = test_cutting(), seed = 2024, weight = fh(rho = 0, gamma = 0.5) ) @@ -65,8 +65,8 @@ test_that("Test 3: weighted logrank test by MB(3)", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = wlr, - cuts = test_cutting(), + test = wlr, + cut = test_cutting(), seed = 2024, weight = mb(delay = 3) ) @@ -91,8 +91,8 @@ test_that("Test 4: weighted logrank test by early zero (6)", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = wlr, - cuts = test_cutting(), + test = wlr, + cut = test_cutting(), seed = 2024, weight = early_zero(6) ) @@ -117,8 +117,8 @@ test_that("Test 5: RMST", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = rmst, - cuts = test_cutting(), + test = rmst, + cut = test_cutting(), seed = 2024, tau = 20 ) @@ -158,8 +158,8 @@ test_that("Test 6: Milestone", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = milestone, - cuts = test_cutting(), + test = milestone, + cut = test_cutting(), seed = 2024, ms_time = 10 ) @@ -211,8 +211,8 @@ test_that("Test 7: MaxCombo (WLR-FH(0,0) + WLR-FH(0, 0.5))", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = maxcombo, - cuts = test_cutting(), + test = maxcombo, + cut = test_cutting(), seed = 2024, rho = c(0, 0), gamma = c(0, 0.5) @@ -242,8 +242,8 @@ test_that("sim_gs_n() accepts different tests per cutting", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = list(wlr_cut1, wlr_cut2, wlr_cut3), - cuts = test_cutting(), + test = list(wlr_cut1, wlr_cut2, wlr_cut3), + cut = test_cutting(), seed = 2024 ) expected <- data.frame( @@ -273,8 +273,8 @@ test_that("sim_gs_n() requires a test for each cutting", { sample_size = 400, enroll_rate = test_enroll_rate(), fail_rate = test_fail_rate(), - tests = list(wlr_cut1, wlr_cut2), - cuts = test_cutting(), + test = list(wlr_cut1, wlr_cut2), + cut = test_cutting(), seed = 2024 ), "If you want to run different tests at each cutting" From ba959a39a3713152abcbbe197c54d7c1a4e7c19c Mon Sep 17 00:00:00 2001 From: John Blischak Date: Fri, 22 Mar 2024 11:27:55 -0400 Subject: [PATCH 3/5] Update argument names in documentation --- R/sim_gs_n.R | 6 +++--- man/sim_gs_n.Rd | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/R/sim_gs_n.R b/R/sim_gs_n.R index d9b31123..6e2ab41b 100644 --- a/R/sim_gs_n.R +++ b/R/sim_gs_n.R @@ -22,7 +22,7 @@ #' arguments will change as we add additional features. #' #' @inheritParams sim_fixed_n -#' @param tests One or more test functions such as [wlr()], [maxcombo()], or +#' @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 @@ -31,8 +31,8 @@ #' 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 cuts A list of cutting functions created by [create_cut()], -#' see examples. +#' @param cut A list of cutting functions created by [create_cut()], see +#' examples. #' @param seed Random seed. #' @param ... Arguments passed to the test function(s) provided by the argument #' `tests`. diff --git a/man/sim_gs_n.Rd b/man/sim_gs_n.Rd index a9f28787..4036b3c2 100644 --- a/man/sim_gs_n.Rd +++ b/man/sim_gs_n.Rd @@ -36,12 +36,7 @@ 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{seed}{Random seed.} - -\item{...}{Arguments passed to the test function(s) provided by the argument -\code{tests}.} - -\item{tests}{One or more test functions such as \code{\link[=wlr]{wlr()}}, \code{\link[=maxcombo]{maxcombo()}}, or +\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 @@ -51,8 +46,13 @@ 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{cuts}{A list of cutting functions created by \code{\link[=create_cut]{create_cut()}}, -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(s) provided by the argument +\code{tests}.} } \value{ A data frame summarizing the simulation ID, analysis date, From 567c0416724dcd7b8b11eb2fc9cd118d7faeeedb Mon Sep 17 00:00:00 2001 From: John Blischak Date: Fri, 22 Mar 2024 11:39:03 -0400 Subject: [PATCH 4/5] Bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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")), From d539ae69571753d76e878ec2424ae37424db8c55 Mon Sep 17 00:00:00 2001 From: John Blischak Date: Mon, 25 Mar 2024 13:20:17 -0400 Subject: [PATCH 5/5] Fix documentation typo from argument renaming --- R/sim_gs_n.R | 2 +- man/sim_gs_n.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/sim_gs_n.R b/R/sim_gs_n.R index 6e2ab41b..863a7c5f 100644 --- a/R/sim_gs_n.R +++ b/R/sim_gs_n.R @@ -35,7 +35,7 @@ #' examples. #' @param seed Random seed. #' @param ... Arguments passed to the test function(s) provided by the argument -#' `tests`. +#' `test`. #' #' @return A data frame summarizing the simulation ID, analysis date, #' z statistics or p-values. diff --git a/man/sim_gs_n.Rd b/man/sim_gs_n.Rd index 4036b3c2..06939310 100644 --- a/man/sim_gs_n.Rd +++ b/man/sim_gs_n.Rd @@ -52,7 +52,7 @@ examples.} \item{seed}{Random seed.} \item{...}{Arguments passed to the test function(s) provided by the argument -\code{tests}.} +\code{test}.} } \value{ A data frame summarizing the simulation ID, analysis date,