From 6a2d12566f9ecc5b24e86f061130e7c27b71b36b Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Dec 2022 10:36:47 -0500 Subject: [PATCH 1/3] update version number --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 79f21bf3..e9457e61 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: gsDesign2 Title: Group Sequential Design with Non-Constant Effect -Version: 0.2.0.9004 +Version: 1.0.0 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 c3a306f8c38bfe01fea3b8c3cded179e140f8b8c Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Dec 2022 11:30:23 -0500 Subject: [PATCH 2/3] fix non-auto code in `as_gt` --- R/as_gt.R | 20 +++++++++++--------- R/gs_power_rd.R | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/R/as_gt.R b/R/as_gt.R index 471174b7..dcf8ec47 100644 --- a/R/as_gt.R +++ b/R/as_gt.R @@ -181,6 +181,11 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...){ #' the \code{location} is a vector of string to specify the locations to put the superscript of the footnote index; #' the \code{attr} is a vector of string to specify the attributes of the footnotes, e.g., c("colname", "title", "subtitle", "analysis", "spanner"); #' users can use the functions in the \code{gt} package to custom themselves. +#' @param full_alpha The full alpha used in the design, the default is 0.025. +#' If the cumulative alpha for final analysis is less than the \code{full_alpha} +#' when the futility bound is non-binding, a footnote will be displayed, saying +#' the smaller value subtracts the probability of crossing a futility bound before +#' crossing an efficacy bound at a later analysis under the null hypothesis. #' @param display_bound a vector of strings specifying the label of the bounds. The default is \code{c("Efficacy", "Futility")} #' @param display_columns a vector of strings specifying the variables to be displayed in the summary table #' @param display_inf_bound a logic value (TRUE or FALSE) whether to display the +-inf bound @@ -214,10 +219,6 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...){ #' as_gt() #' #' -#' gs_design_combo() %>% -#' summary() %>% -#' as_gt() -#' #' gs_power_combo() %>% #' summary() %>% #' as_gt() @@ -281,10 +282,11 @@ as_gt.gs_design <- function( display_bound = c("Efficacy", "Futility"), display_columns = NULL, display_inf_bound = TRUE, + full_alpha = 0.025, ... ){ method <- class(x)[class(x) %in% c("ahr", "wlr", "combo", "rd")] - x_alpha <- max((x %>% dplyr::filter(Bound == "Efficacy"))$`Null hypothesis`) + x_alpha <- max((x %>% dplyr::filter(Bound == display_bound[1]))[[colname_spannersub[2]]]) x_non_binding <- "non-binding" %in% class(x) x_k <- lapply(x$Analysis, function(x){return(as.numeric(substring(x, 11, 11)))}) %>% unlist() x_old <- x @@ -448,17 +450,17 @@ as_gt.gs_design <- function( } ## if it is non-binding design - if(x_non_binding & (x_alpha < 0.025)){ + if(x_non_binding & (x_alpha < full_alpha)){ x <- x %>% gt::tab_footnote( footnote = paste0("Cumulative alpha for final analysis (", x_alpha, ") is less than the full alpha (0.025) when the futility bound is non-binding. ", "The smaller value subtracts the probability of crossing a futility bound before ", " crossing an efficacy bound at a later analysis (0.025 - ", - 0.025 - x_alpha, " = ", x_alpha, ") under the null hypothesis."), + full_alpha - x_alpha, " = ", x_alpha, ") under the null hypothesis."), locations = gt::cells_body( - columns = `Null hypothesis`, - rows = (substring(x_old$Analysis, 1, 11) == paste0("Analysis: ", max(x_k))) & (x_old$Bound == "Efficacy") + columns = colname_spannersub[2], + rows = (substring(x_old$Analysis, 1, 11) == paste0("Analysis: ", max(x_k))) & (x_old$Bound == display_bound[1]) ) ) } diff --git a/R/gs_power_rd.R b/R/gs_power_rd.R index 5f581c7a..48a6e41a 100644 --- a/R/gs_power_rd.R +++ b/R/gs_power_rd.R @@ -202,7 +202,7 @@ gs_power_rd <- function( upper = gs_b, lower = gs_b, upar = gsDesign(k = length(N), test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound, - lpar = c(qnorm(.1), rep(-Inf, length(N) - 1)), + lpar = c(qnorm(.1), rep(-Inf, 2)), info_scale = c(0, 1, 2), binding = FALSE, test_upper = TRUE, From 46789dc1deb1cca2d96e8887411241a450b58a95 Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Fri, 16 Dec 2022 11:31:00 -0500 Subject: [PATCH 3/3] update documentation --- man/as_gt.gs_design.Rd | 11 +++++++---- man/gs_power_rd.Rd | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/man/as_gt.gs_design.Rd b/man/as_gt.gs_design.Rd index b6b699d9..6c06d38b 100644 --- a/man/as_gt.gs_design.Rd +++ b/man/as_gt.gs_design.Rd @@ -14,6 +14,7 @@ display_bound = c("Efficacy", "Futility"), display_columns = NULL, display_inf_bound = TRUE, + full_alpha = 0.025, ... ) } @@ -40,6 +41,12 @@ users can use the functions in the \code{gt} package to custom themselves.} \item{display_inf_bound}{a logic value (TRUE or FALSE) whether to display the +-inf bound} +\item{full_alpha}{The full alpha used in the design, the default is 0.025. +If the cumulative alpha for final analysis is less than the \code{full_alpha} +when the futility bound is non-binding, a footnote will be displayed, saying +the smaller value subtracts the probability of crossing a futility bound before +crossing an efficacy bound at a later analysis under the null hypothesis.} + \item{...}{additional arguments} } \value{ @@ -70,10 +77,6 @@ gs_power_wlr() \%>\% as_gt() -gs_design_combo() \%>\% - summary() \%>\% - as_gt() - gs_power_combo() \%>\% summary() \%>\% as_gt() diff --git a/man/gs_power_rd.Rd b/man/gs_power_rd.Rd index 599abe1e..e6a1e177 100644 --- a/man/gs_power_rd.Rd +++ b/man/gs_power_rd.Rd @@ -14,7 +14,7 @@ gs_power_rd( upper = gs_b, lower = gs_b, upar = gsDesign(k = length(N), test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound, - lpar = c(qnorm(0.1), rep(-Inf, length(N) - 1)), + lpar = c(qnorm(0.1), rep(-Inf, 2)), info_scale = c(0, 1, 2), binding = FALSE, test_upper = TRUE,