Skip to content

Commit 13cf12b

Browse files
authored
Merge pull request #128 from Merck/127-documentation-fix-before-the-dec-github-release
127 documentation fix before the dec GitHub release
2 parents e4828fe + 46789dc commit 13cf12b

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: gsDesign2
22
Title: Group Sequential Design with Non-Constant Effect
3-
Version: 0.2.0.9004
3+
Version: 1.0.0
44
Authors@R: c(
55
person("Keaven", "Anderson", email = "keaven_anderson@merck.com", role = c("aut")),
66
person("Yilong", "Zhang", email = "elong0527@gmail.com", role = c("aut")),

R/as_gt.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...){
181181
#' the \code{location} is a vector of string to specify the locations to put the superscript of the footnote index;
182182
#' the \code{attr} is a vector of string to specify the attributes of the footnotes, e.g., c("colname", "title", "subtitle", "analysis", "spanner");
183183
#' users can use the functions in the \code{gt} package to custom themselves.
184+
#' @param full_alpha The full alpha used in the design, the default is 0.025.
185+
#' If the cumulative alpha for final analysis is less than the \code{full_alpha}
186+
#' when the futility bound is non-binding, a footnote will be displayed, saying
187+
#' the smaller value subtracts the probability of crossing a futility bound before
188+
#' crossing an efficacy bound at a later analysis under the null hypothesis.
184189
#' @param display_bound a vector of strings specifying the label of the bounds. The default is \code{c("Efficacy", "Futility")}
185190
#' @param display_columns a vector of strings specifying the variables to be displayed in the summary table
186191
#' @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, ...){
214219
#' as_gt()
215220
#'
216221
#'
217-
#' gs_design_combo() %>%
218-
#' summary() %>%
219-
#' as_gt()
220-
#'
221222
#' gs_power_combo() %>%
222223
#' summary() %>%
223224
#' as_gt()
@@ -281,10 +282,11 @@ as_gt.gs_design <- function(
281282
display_bound = c("Efficacy", "Futility"),
282283
display_columns = NULL,
283284
display_inf_bound = TRUE,
285+
full_alpha = 0.025,
284286
...
285287
){
286288
method <- class(x)[class(x) %in% c("ahr", "wlr", "combo", "rd")]
287-
x_alpha <- max((x %>% dplyr::filter(Bound == "Efficacy"))$`Null hypothesis`)
289+
x_alpha <- max((x %>% dplyr::filter(Bound == display_bound[1]))[[colname_spannersub[2]]])
288290
x_non_binding <- "non-binding" %in% class(x)
289291
x_k <- lapply(x$Analysis, function(x){return(as.numeric(substring(x, 11, 11)))}) %>% unlist()
290292
x_old <- x
@@ -448,17 +450,17 @@ as_gt.gs_design <- function(
448450
}
449451

450452
## if it is non-binding design
451-
if(x_non_binding & (x_alpha < 0.025)){
453+
if(x_non_binding & (x_alpha < full_alpha)){
452454
x <- x %>%
453455
gt::tab_footnote(
454456
footnote = paste0("Cumulative alpha for final analysis (", x_alpha,
455457
") is less than the full alpha (0.025) when the futility bound is non-binding. ",
456458
"The smaller value subtracts the probability of crossing a futility bound before ",
457459
" crossing an efficacy bound at a later analysis (0.025 - ",
458-
0.025 - x_alpha, " = ", x_alpha, ") under the null hypothesis."),
460+
full_alpha - x_alpha, " = ", x_alpha, ") under the null hypothesis."),
459461
locations = gt::cells_body(
460-
columns = `Null hypothesis`,
461-
rows = (substring(x_old$Analysis, 1, 11) == paste0("Analysis: ", max(x_k))) & (x_old$Bound == "Efficacy")
462+
columns = colname_spannersub[2],
463+
rows = (substring(x_old$Analysis, 1, 11) == paste0("Analysis: ", max(x_k))) & (x_old$Bound == display_bound[1])
462464
)
463465
)
464466
}

R/gs_power_rd.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ gs_power_rd <- function(
202202
upper = gs_b,
203203
lower = gs_b,
204204
upar = gsDesign(k = length(N), test.type = 1, sfu = sfLDOF, sfupar = NULL)$upper$bound,
205-
lpar = c(qnorm(.1), rep(-Inf, length(N) - 1)),
205+
lpar = c(qnorm(.1), rep(-Inf, 2)),
206206
info_scale = c(0, 1, 2),
207207
binding = FALSE,
208208
test_upper = TRUE,

man/as_gt.gs_design.Rd

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gs_power_rd.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)