@@ -181,6 +181,11 @@ as_gt.fixed_design <- function(x, title = NULL, footnote = NULL, ...){
181
181
# ' the \code{location} is a vector of string to specify the locations to put the superscript of the footnote index;
182
182
# ' the \code{attr} is a vector of string to specify the attributes of the footnotes, e.g., c("colname", "title", "subtitle", "analysis", "spanner");
183
183
# ' 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.
184
189
# ' @param display_bound a vector of strings specifying the label of the bounds. The default is \code{c("Efficacy", "Futility")}
185
190
# ' @param display_columns a vector of strings specifying the variables to be displayed in the summary table
186
191
# ' @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, ...){
214
219
# ' as_gt()
215
220
# '
216
221
# '
217
- # ' gs_design_combo() %>%
218
- # ' summary() %>%
219
- # ' as_gt()
220
- # '
221
222
# ' gs_power_combo() %>%
222
223
# ' summary() %>%
223
224
# ' as_gt()
@@ -281,10 +282,11 @@ as_gt.gs_design <- function(
281
282
display_bound = c(" Efficacy" , " Futility" ),
282
283
display_columns = NULL ,
283
284
display_inf_bound = TRUE ,
285
+ full_alpha = 0.025 ,
284
286
...
285
287
){
286
288
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 ]]] )
288
290
x_non_binding <- " non-binding" %in% class(x )
289
291
x_k <- lapply(x $ Analysis , function (x ){return (as.numeric(substring(x , 11 , 11 )))}) %> % unlist()
290
292
x_old <- x
@@ -448,17 +450,17 @@ as_gt.gs_design <- function(
448
450
}
449
451
450
452
# # if it is non-binding design
451
- if (x_non_binding & (x_alpha < 0.025 )){
453
+ if (x_non_binding & (x_alpha < full_alpha )){
452
454
x <- x %> %
453
455
gt :: tab_footnote(
454
456
footnote = paste0(" Cumulative alpha for final analysis (" , x_alpha ,
455
457
" ) is less than the full alpha (0.025) when the futility bound is non-binding. " ,
456
458
" The smaller value subtracts the probability of crossing a futility bound before " ,
457
459
" 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." ),
459
461
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 ] )
462
464
)
463
465
)
464
466
}
0 commit comments