diff --git a/DESCRIPTION b/DESCRIPTION index 272fa68a..273bd4e9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: graphicalMCP Title: Graphical Multiple Comparison Procedures -Version: 0.1.0 +Version: 0.1.1 Authors@R: c( person("Dong", "Xi", , "dong.xi1@gilead.com", role = c("aut", "cre")), person("Ethan", "Brockmann", , "ethan.brockmann@atorusresearch.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 03773f79..1e0a137b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ # graphicalMCP 0.1.0 * First release + +# graphicalMCP 0.1.1 + +* Added compilation of vignettes (#73) +* De-duplicated test values column names (#75) diff --git a/R/as_graph.R b/R/as_graph.R index 9e456381..1dee2423 100644 --- a/R/as_graph.R +++ b/R/as_graph.R @@ -45,10 +45,10 @@ as_initial_graph.igraph <- function(graph) { hypotheses <- igraph::vertex_attr(graph, "weight") names(hypotheses) <- igraph::vertex_attr(graph, "name") - transitions <- matrix(0, length(graph), length(graph)) - dimnames(transitions) <- rep(list(igraph::vertex_attr(graph, "name")), 2) + transitions <- matrix(0, length(hypotheses), length(hypotheses)) + dimnames(transitions) <- rep(list(names(hypotheses)), 2) - for (tail in seq_along(graph)) { + for (tail in seq_along(hypotheses)) { transitions[tail, ] <- graph[tail] } diff --git a/R/graph_rejection_orderings.R b/R/graph_rejection_orderings.R index bf74299c..9df41951 100644 --- a/R/graph_rejection_orderings.R +++ b/R/graph_rejection_orderings.R @@ -44,7 +44,7 @@ graph_rejection_orderings <- function(shortcut_test_result) { rev(expand.grid(rep(list(rejected), length(rejected)))), 1, function(row) { - if (length(unique(row)) == length(row)){ + if (length(unique(row)) == length(row)) { structure(row, names = hyp_names[row]) } else { NULL @@ -61,7 +61,6 @@ graph_rejection_orderings <- function(shortcut_test_result) { intermediate_graph <- graph for (hyp_num in hyp_ordering) { - if (p[[hyp_num]] <= intermediate_graph$hypotheses[[hyp_num]] * alpha) { intermediate_graph <- graph_update(intermediate_graph, hyp_num)$updated_graph diff --git a/R/graph_test_closure.R b/R/graph_test_closure.R index 42d24321..61190159 100644 --- a/R/graph_test_closure.R +++ b/R/graph_test_closure.R @@ -309,12 +309,10 @@ graph_test_closure <- function(graph, df_test_values <- do.call(rbind, test_values_list) rownames(df_test_values) <- NULL - - # "c" value is only used in parametric testing, so there's no need to # include this column when there are no parametric groups if (!any(test_types == "parametric")) { - df_test_values[c("c_value", "*")] <- NULL + df_test_values[c("c_value*")] <- NULL } } diff --git a/R/graph_test_shortcut.R b/R/graph_test_shortcut.R index e6e4e88f..b0c2ad08 100644 --- a/R/graph_test_shortcut.R +++ b/R/graph_test_shortcut.R @@ -146,7 +146,7 @@ graph_test_shortcut <- function(graph, # algorithm") names(test_values_step)[[1]] <- "Step" test_values_step$Step <- step_num - test_values_step[c("Test", "c_value", "*")] <- NULL + test_values_step[c("Test", "c_value*")] <- NULL df_test_values <- rbind(df_test_values, test_values_step) @@ -161,6 +161,7 @@ graph_test_shortcut <- function(graph, step_graph <- graph_after_rejections } } + rownames(df_test_values) <- NULL } # Build the report ----------------------------------------------------------- diff --git a/R/plot.initial_graph.R b/R/plot.initial_graph.R index 8e21d340..6fefb407 100644 --- a/R/plot.initial_graph.R +++ b/R/plot.initial_graph.R @@ -64,23 +64,23 @@ #' #' epsilon <- 1e-5 #' transitions <- rbind( -#' c(0, 0.5, 0.25, 0, 0.25, 0), -#' c(0.5, 0, 0, 0.25, 0, 0.25), -#' c(0, 0, 0, 0, 1, 0), -#' c(epsilon, 0, 0, 0, 0, 1 - epsilon), -#' c(0, epsilon, 1 - epsilon, 0, 0, 0), -#' c(0, 0, 0, 1, 0, 0) +#' c(0, 0.5, 0.25, 0, 0.25, 0), +#' c(0.5, 0, 0, 0.25, 0, 0.25), +#' c(0, 0, 0, 0, 1, 0), +#' c(epsilon, 0, 0, 0, 0, 1 - epsilon), +#' c(0, epsilon, 1 - epsilon, 0, 0, 0), +#' c(0, 0, 0, 1, 0, 0) #' ) #' #' g <- graph_create(hypotheses, transitions) #' #' plot_layout <- rbind( -#' c(.15, .5), -#' c(.65, .5), -#' c( 0, 0), -#' c( .5, 0), -#' c( .3, 0), -#' c( .8, 0) +#' c(0.15, 0.5), +#' c(0.65, 0.5), +#' c(0, 0), +#' c(0.5, 0), +#' c(0.3, 0), +#' c(0.8, 0) #' ) #' #' plot(g, layout = plot_layout, eps = epsilon, edge_curves = c(pairs = .5)) diff --git a/R/print.graph_report.R b/R/print.graph_report.R index 88b47113..fd661433 100644 --- a/R/print.graph_report.R +++ b/R/print.graph_report.R @@ -186,9 +186,9 @@ print.graph_report <- function(x, ..., precision = 4, indent = 2, rows = 10) { section_break("Detailed test values ($test_values)") if (any(x$inputs$test_types == "parametric")) { - num_cols <- c("p", "c_value", "Weight", "Alpha") + num_cols <- c("p", "c_value*", "Weight*", "Alpha") } else { - num_cols <- c("p", "Weight", "Alpha") + num_cols <- c("p", "Weight*", "Alpha") } crit_res <- x$test_values$results @@ -200,10 +200,10 @@ print.graph_report <- function(x, ..., precision = 4, indent = 2, rows = 10) { } ) if (any(x$inputs$test_types == "parametric")) { - crit_res$c_value <- ifelse( - trimws(crit_res$c_value) == "NA", + crit_res$"c_value*" <- ifelse( + trimws(crit_res$"c_value*") == "NA", "", - crit_res$c_value + crit_res$"c_value*" ) } diff --git a/R/test_values.R b/R/test_values.R index 45fa91ae..fd5be1d8 100644 --- a/R/test_values.R +++ b/R/test_values.R @@ -36,10 +36,8 @@ test_values_bonferroni <- function(p, hypotheses, alpha, intersection = NA) { Test = "bonferroni", p = p, "<=" = "<=", - c_value = "", - "*" = "", - Weight = hypotheses, - "*" = "*", + "c_value*" = "", + "Weight*" = hypotheses, Alpha = alpha, Inequality_holds = ifelse( p == 0 & hypotheses == 0, @@ -68,10 +66,8 @@ test_values_parametric <- function(p, Test = "parametric", p = p, "<=" = "<=", - c_value = c_value, - "*" = "*", - Weight = hypotheses, - "*" = "*", + "c_value*" = c_value, + "Weight*" = hypotheses, Alpha = alpha, Inequality_holds = ifelse( p == 0 & hypotheses == 0, @@ -102,10 +98,8 @@ test_values_simes <- function(p, hypotheses, alpha, intersection = NA) { Test = "simes", p = p, "<=" = "<=", - c_value = "", - "*" = "", - Weight = w_sum, - "*" = "*", + "c_value*" = "", + "Weight*" = w_sum, Alpha = alpha, Inequality_holds = ifelse( p == 0 & w_sum == 0, diff --git a/man/adjust_p.Rd b/man/adjust_p.Rd index 2abc98ef..b6135211 100644 --- a/man/adjust_p.Rd +++ b/man/adjust_p.Rd @@ -48,29 +48,29 @@ graphicalMCP:::adjust_p_parametric(p, w, corr2) \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/adjusted-weights.Rd b/man/adjusted-weights.Rd index 48ff90fb..6c7cb91e 100644 --- a/man/adjusted-weights.Rd +++ b/man/adjusted-weights.Rd @@ -84,29 +84,29 @@ graphicalMCP:::adjust_weights_simes(gw_0, p, list(4:6)) \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/calc-test_values.Rd b/man/calc-test_values.Rd index eae05563..4eff8c1f 100644 --- a/man/calc-test_values.Rd +++ b/man/calc-test_values.Rd @@ -45,29 +45,29 @@ graphicalMCP:::test_values_simes(p, w, .05) \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/example-graphs.Rd b/man/example-graphs.Rd index 1c4da935..e0d430bd 100644 --- a/man/example-graphs.Rd +++ b/man/example-graphs.Rd @@ -50,29 +50,29 @@ bonferroni_holm(3, hyp_names = paste("dose", letters[1:3])) \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/graph_calculate_power.Rd b/man/graph_calculate_power.Rd index 0a1cf4e4..72a2e1c9 100644 --- a/man/graph_calculate_power.Rd +++ b/man/graph_calculate_power.Rd @@ -57,7 +57,7 @@ A list with three elements \item power - A list of measures of how often hypotheses are rejected \itemize{ \item power_local - Rejection proportion for each hypothesis individually -\item power_expected - Average number of hypotheses rejected in a single +\item rejection_expected - Average number of hypotheses rejected in a single simulation \item power_at_least_1 - Proportion of simulations which reject any hypothesis @@ -122,29 +122,29 @@ graph_calculate_power( \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/graph_create.Rd b/man/graph_create.Rd index 4377a862..a0ac062c 100644 --- a/man/graph_create.Rd +++ b/man/graph_create.Rd @@ -104,29 +104,29 @@ g \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/graph_generate_weights.Rd b/man/graph_generate_weights.Rd index 0bc639ee..f2edc900 100644 --- a/man/graph_generate_weights.Rd +++ b/man/graph_generate_weights.Rd @@ -48,29 +48,29 @@ graph_generate_weights(par_gate) \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/graph_update.Rd b/man/graph_update.Rd index bb0c1b59..fce67872 100644 --- a/man/graph_update.Rd +++ b/man/graph_update.Rd @@ -53,29 +53,29 @@ graph_update(g, 2:3) \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/graphicalMCP-package.Rd b/man/graphicalMCP-package.Rd index 4b8117ca..0661c9fe 100644 --- a/man/graphicalMCP-package.Rd +++ b/man/graphicalMCP-package.Rd @@ -4,11 +4,11 @@ \name{graphicalMCP-package} \alias{graphicalMCP} \alias{graphicalMCP-package} -\title{graphicalMCP: Graphical Approach for Multiple Comparison Procedures} +\title{graphicalMCP: Graphical Multiple Comparison Procedures} \description{ \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} -A multiple comparison procedure (or multiple test procedure) is a a statistical analysis method for determining efficacy of multiple drugs, or multiple doses of the same drug, in a single clinical trial. (Bretz et al., 2011) laid out a graph-based approach to these multiple comparison procedures, in which the weights of the vertices and edges of the graph are determined independently of the particular statistical test used to assess results. This is a low-dependency implementation of the methods described in that and subsequent papers. +Graphical multiple comparison procedures (MCPs) control the familywise error rate. This class includes many commonly used procedures as special cases. This package is a low-dependency implementation of graphical MCPs which allow mixed types of tests. It also includes power simulations and visualization of graphical MCPs. } \seealso{ Useful links: diff --git a/man/plot.initial_graph.Rd b/man/plot.initial_graph.Rd index d39ed168..11f51937 100644 --- a/man/plot.initial_graph.Rd +++ b/man/plot.initial_graph.Rd @@ -97,23 +97,23 @@ hypotheses <- c(0.5, 0.5, 0, 0, 0, 0) epsilon <- 1e-5 transitions <- rbind( - c(0, 0.5, 0.25, 0, 0.25, 0), - c(0.5, 0, 0, 0.25, 0, 0.25), - c(0, 0, 0, 0, 1, 0), - c(epsilon, 0, 0, 0, 0, 1 - epsilon), - c(0, epsilon, 1 - epsilon, 0, 0, 0), - c(0, 0, 0, 1, 0, 0) + c(0, 0.5, 0.25, 0, 0.25, 0), + c(0.5, 0, 0, 0.25, 0, 0.25), + c(0, 0, 0, 0, 1, 0), + c(epsilon, 0, 0, 0, 0, 1 - epsilon), + c(0, epsilon, 1 - epsilon, 0, 0, 0), + c(0, 0, 0, 1, 0, 0) ) g <- graph_create(hypotheses, transitions) plot_layout <- rbind( - c(.15, .5), - c(.65, .5), - c( 0, 0), - c( .5, 0), - c( .3, 0), - c( .8, 0) + c(0.15, 0.5), + c(0.65, 0.5), + c(0, 0), + c(0.5, 0), + c(0.3, 0), + c(0.8, 0) ) plot(g, layout = plot_layout, eps = epsilon, edge_curves = c(pairs = .5)) diff --git a/man/testing-fast.Rd b/man/testing-fast.Rd index fb0fb198..6210c665 100644 --- a/man/testing-fast.Rd +++ b/man/testing-fast.Rd @@ -66,29 +66,29 @@ graphicalMCP:::graph_test_shortcut_fast( \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/man/testing.Rd b/man/testing.Rd index d3e1b197..10812aa9 100644 --- a/man/testing.Rd +++ b/man/testing.Rd @@ -111,29 +111,29 @@ graph_test_closure( \references{ Bretz, F., Maurer, W., Brannath, W., and Posch, M. (2009). A graphical approach to sequentially rejective multiple test procedures. Statistics in -Medicine, 28(4), 586–604. \url{https://doi.org/10.1002/sim.3495} +Medicine, 28(4), 586-604. \url{https://doi.org/10.1002/sim.3495} Bretz, F., Maurer, W., and Hommel, G. (2011). Test and power considerations for multiple endpoint analyses using sequentially rejective graphical -procedures. Statistics in Medicine, 30(13), 1489–1501. +procedures. Statistics in Medicine, 30(13), 1489-1501. \url{https://doi.org/10.1002/sim.3988} Bretz, F., Posch, M., Glimm, E., Klinglmueller, F., Maurer, W., and Rohmeyer, K. (2011). Graphical approaches for multiple comparison procedures using weighted Bonferroni, Simes, or parametric tests. Biometrical Journal, 53(6), -894–913. \url{https://doi.org/10.1002/bimj.201000239} +894-913. \url{https://doi.org/10.1002/bimj.201000239} Lu, K. (2016). Graphical approaches using a Bonferroni mixture of weighted -Simes tests. Statistics in Medicine, 35(22), 4041–4055. +Simes tests. Statistics in Medicine, 35(22), 4041-4055. \url{https://doi.org/10.1002/sim.6985} Xi, D., Glimm, E., Maurer, W., and Bretz, F. (2017). A unified framework for weighted parametric multiple test procedures. Biometrical Journal, 59(5), -918–931. \url{https://doi.org/10.1002/bimj.201600233} +918-931. \url{https://doi.org/10.1002/bimj.201600233} Xi, D., and Bretz, F. (2019). Symmetric graphs for equally weighted tests, with application to the Hochberg procedure. Statistics in Medicine, 38(27), -5268–5282. \url{https://doi.org/10.1002/sim.8375} +5268-5282. \url{https://doi.org/10.1002/sim.8375} Rohmeyer K, Klinglmueller F (2020). \emph{gMCP: Graph Based Multiple Test Procedures}. R package version 0.8-15, diff --git a/tests/testthat/_snaps/print.graph_report.md b/tests/testthat/_snaps/print.graph_report.md index d73cee3c..6dfaa9b4 100644 --- a/tests/testthat/_snaps/print.graph_report.md +++ b/tests/testthat/_snaps/print.graph_report.md @@ -171,17 +171,17 @@ H4 NA NA NA NA Detailed test values ($test_values) -------------------------------------------- - Intersection Hypothesis Test p <= Weight * Alpha Inequality_holds - 1111 H1 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1111 H2 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1111 H3 bonferroni 0.01 <= 0.0 * 0.025 FALSE - 1111 H4 bonferroni 0.01 <= 0.0 * 0.025 FALSE - 1110 H1 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1110 H2 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1110 H3 bonferroni 0.01 <= 0.0 * 0.025 FALSE - 1101 H1 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1101 H2 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1101 H4 bonferroni 0.01 <= 0.0 * 0.025 FALSE + Intersection Hypothesis Test p <= Weight* Alpha Inequality_holds + 1111 H1 bonferroni 0.01 <= 0.5 0.025 TRUE + 1111 H2 bonferroni 0.01 <= 0.5 0.025 TRUE + 1111 H3 bonferroni 0.01 <= 0.0 0.025 FALSE + 1111 H4 bonferroni 0.01 <= 0.0 0.025 FALSE + 1110 H1 bonferroni 0.01 <= 0.5 0.025 TRUE + 1110 H2 bonferroni 0.01 <= 0.5 0.025 TRUE + 1110 H3 bonferroni 0.01 <= 0.0 0.025 FALSE + 1101 H1 bonferroni 0.01 <= 0.5 0.025 TRUE + 1101 H2 bonferroni 0.01 <= 0.5 0.025 TRUE + 1101 H4 bonferroni 0.01 <= 0.0 0.025 FALSE ... (Use `print(x, rows = )` for more) @@ -330,17 +330,17 @@ ... (Use `print(x, rows = )` for more) Detailed test values ($test_values) -------------------------------------------- - Intersection Hypothesis Test p <= c_value * Weight * Alpha - 1111 H1 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1111 H2 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1111 H3 simes 0.01 <= 0.0 * 0.025 - 1111 H4 simes 0.01 <= 0.0 * 0.025 - 1110 H1 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1110 H2 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1110 H3 simes 0.01 <= 0.0 * 0.025 - 1101 H1 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1101 H2 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1101 H4 simes 0.01 <= 0.0 * 0.025 + Intersection Hypothesis Test p <= c_value* Weight* Alpha + 1111 H1 parametric 0.01 <= 1.006 0.5 0.025 + 1111 H2 parametric 0.01 <= 1.006 0.5 0.025 + 1111 H3 simes 0.01 <= 0.0 0.025 + 1111 H4 simes 0.01 <= 0.0 0.025 + 1110 H1 parametric 0.01 <= 1.006 0.5 0.025 + 1110 H2 parametric 0.01 <= 1.006 0.5 0.025 + 1110 H3 simes 0.01 <= 0.0 0.025 + 1101 H1 parametric 0.01 <= 1.006 0.5 0.025 + 1101 H2 parametric 0.01 <= 1.006 0.5 0.025 + 1101 H4 simes 0.01 <= 0.0 0.025 Inequality_holds TRUE TRUE @@ -442,17 +442,17 @@ ... (Use `print(x, rows = )` for more) Detailed test values ($test_values) -------------------------------------------- - Intersection Hypothesis Test p <= c_value * Weight * Alpha - 1111 H1 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1111 H2 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1111 H3 parametric 0.01 <= 1.000 * 0.0 * 0.025 - 1111 H4 parametric 0.01 <= 1.000 * 0.0 * 0.025 - 1110 H1 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1110 H2 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1110 H3 parametric 0.01 <= 1.000 * 0.0 * 0.025 - 1101 H1 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1101 H2 parametric 0.01 <= 1.006 * 0.5 * 0.025 - 1101 H4 parametric 0.01 <= 1.000 * 0.0 * 0.025 + Intersection Hypothesis Test p <= c_value* Weight* Alpha + 1111 H1 parametric 0.01 <= 1.006 0.5 0.025 + 1111 H2 parametric 0.01 <= 1.006 0.5 0.025 + 1111 H3 parametric 0.01 <= 1.000 0.0 0.025 + 1111 H4 parametric 0.01 <= 1.000 0.0 0.025 + 1110 H1 parametric 0.01 <= 1.006 0.5 0.025 + 1110 H2 parametric 0.01 <= 1.006 0.5 0.025 + 1110 H3 parametric 0.01 <= 1.000 0.0 0.025 + 1101 H1 parametric 0.01 <= 1.006 0.5 0.025 + 1101 H2 parametric 0.01 <= 1.006 0.5 0.025 + 1101 H4 parametric 0.01 <= 1.000 0.0 0.025 Inequality_holds TRUE TRUE @@ -895,17 +895,17 @@ ... (Use `print(x, rows = )` for more) Detailed test values ($test_values) -------------------------------------------- - Intersection Hypothesis Test p <= Weight * Alpha Inequality_holds - 1111 H1 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1111 H2 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1111 H3 bonferroni 0.01 <= 0.0 * 0.025 FALSE - 1111 H4 bonferroni 0.01 <= 0.0 * 0.025 FALSE - 1110 H1 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1110 H2 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1110 H3 bonferroni 0.01 <= 0.0 * 0.025 FALSE - 1101 H1 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1101 H2 bonferroni 0.01 <= 0.5 * 0.025 TRUE - 1101 H4 bonferroni 0.01 <= 0.0 * 0.025 FALSE + Intersection Hypothesis Test p <= Weight* Alpha Inequality_holds + 1111 H1 bonferroni 0.01 <= 0.5 0.025 TRUE + 1111 H2 bonferroni 0.01 <= 0.5 0.025 TRUE + 1111 H3 bonferroni 0.01 <= 0.0 0.025 FALSE + 1111 H4 bonferroni 0.01 <= 0.0 0.025 FALSE + 1110 H1 bonferroni 0.01 <= 0.5 0.025 TRUE + 1110 H2 bonferroni 0.01 <= 0.5 0.025 TRUE + 1110 H3 bonferroni 0.01 <= 0.0 0.025 FALSE + 1101 H1 bonferroni 0.01 <= 0.5 0.025 TRUE + 1101 H2 bonferroni 0.01 <= 0.5 0.025 TRUE + 1101 H4 bonferroni 0.01 <= 0.0 0.025 FALSE ... (Use `print(x, rows = )` for more) @@ -1054,11 +1054,11 @@ H4 NA NA NA NA Detailed test values ($test_values) -------------------------------------------- - Step Hypothesis p <= Weight * Alpha Inequality_holds - 1 H1 0.01 <= 0.5 * 0.025 TRUE - 2 H2 0.01 <= 0.5 * 0.025 TRUE - 3 H3 0.01 <= 0.5 * 0.025 TRUE - 4 H4 0.01 <= 1.0 * 0.025 TRUE + Step Hypothesis p <= Weight* Alpha Inequality_holds + 1 H1 0.01 <= 0.5 0.025 TRUE + 2 H2 0.01 <= 0.5 0.025 TRUE + 3 H3 0.01 <= 0.5 0.025 TRUE + 4 H4 0.01 <= 1.0 0.025 TRUE --- @@ -1247,13 +1247,13 @@ H6 NA NA NA NA NA NA Detailed test values ($test_values) -------------------------------------------- - Step Hypothesis p <= Weight * Alpha Inequality_holds - 1 H4 0.010 <= 0.50 * 0.025 TRUE - 2 H6 0.000 <= 0.25 * 0.025 TRUE - 3 H5 0.005 <= 0.50 * 0.025 TRUE - 4 H1 0.025 <= 1.00 * 0.025 TRUE - 5 H3 0.015 <= 0.50 * 0.025 FALSE - 5 H2 0.020 <= 0.50 * 0.025 FALSE + Step Hypothesis p <= Weight* Alpha Inequality_holds + 1 H4 0.010 <= 0.50 0.025 TRUE + 2 H6 0.000 <= 0.25 0.025 TRUE + 3 H5 0.005 <= 0.50 0.025 TRUE + 4 H1 0.025 <= 1.00 0.025 TRUE + 5 H3 0.015 <= 0.50 0.025 FALSE + 5 H2 0.020 <= 0.50 0.025 FALSE --- @@ -1480,13 +1480,13 @@ H6 NA NA NA NA NA NA Detailed test values ($test_values) -------------------------------------------- - Step Hypothesis p <= Weight * Alpha Inequality_holds - 1 H4 0.0075 <= 0.50 * 0.025 TRUE - 2 H6 0.0025 <= 0.25 * 0.025 TRUE - 3 H5 0.0050 <= 0.50 * 0.025 TRUE - 4 H1 0.0150 <= 1.00 * 0.025 TRUE - 5 H3 0.0100 <= 0.50 * 0.025 TRUE - 6 H2 0.0125 <= 1.00 * 0.025 TRUE + Step Hypothesis p <= Weight* Alpha Inequality_holds + 1 H4 0.0075 <= 0.50 0.025 TRUE + 2 H6 0.0025 <= 0.25 0.025 TRUE + 3 H5 0.0050 <= 0.50 0.025 TRUE + 4 H1 0.0150 <= 1.00 0.025 TRUE + 5 H3 0.0100 <= 0.50 0.025 TRUE + 6 H2 0.0125 <= 1.00 0.025 TRUE Alternate rejection orderings ($valid_rejection_orderings) --------------------- H4 H5 H6 H1 H2 H3 diff --git a/tests/testthat/test-graph_test_closure.R b/tests/testthat/test-graph_test_closure.R index 863e2b93..42a3aaa2 100644 --- a/tests/testthat/test-graph_test_closure.R +++ b/tests/testthat/test-graph_test_closure.R @@ -308,7 +308,6 @@ test_that("compare adjusted p-values to lrstat - Bonferroni & Simes", { ignore_attr = TRUE ) } - } }) @@ -352,7 +351,7 @@ test_that("closure internal consistency", { if (requireNamespace("dplyr", quietly = TRUE)) { df_test_values_inter_reject <- dplyr::mutate( dplyr::group_by( - tibble::as_tibble(closure_results$test_values$results[-c(7, 9)]), + tibble::as_tibble(closure_results$test_values$results), Intersection ), Hypothesis = Hypothesis, diff --git a/vignettes/closed-testing.Rmd b/vignettes/closed-testing.Rmd index 68f662cc..38b3df03 100644 --- a/vignettes/closed-testing.Rmd +++ b/vignettes/closed-testing.Rmd @@ -55,19 +55,19 @@ hyp_names <- c("H1", "H2", "H3", "H4", "H5", "H6") g <- graph_create(hypotheses, transitions, hyp_names) plot_layout <- rbind( - c(.15, .5), - c(.65, .5), + c(0.15, 0.5), + c(0.65, 0.5), c(0, 0), - c(.5, 0), - c(.3, 0), - c(.8, 0) + c(0.5, 0), + c(0.3, 0), + c(0.8, 0) ) plot( g, layout = plot_layout, eps = epsilon, - edge_curves = c(pairs = .8), + edge_curves = c(pairs = 0.8), vertex.size = 35 ) ``` @@ -80,12 +80,12 @@ Given a set of p-values for $H_1, \ldots, H_6$, the graphical multiple compariso ```{r graph-test-bonferroni} p_values <- c(0.015, 0.013, 0.01, 0.007, 0.1, 0.0124) test_results <- graph_test_closure( - g, - p = p_values, - alpha = 0.025, - verbose = TRUE, + g, + p = p_values, + alpha = 0.025, + verbose = TRUE, test_values = TRUE - ) +) test_results$outputs$adjusted_p @@ -203,7 +203,7 @@ sample_size <- rep(200, 3) unpooled_variance <- prop[-1] * (1 - prop[-1]) / sample_size[-1] + - prop[1] * (1 - prop[1]) / sample_size[1] + prop[1] * (1 - prop[1]) / sample_size[1] noncentrality_parameter_primary <- -(prop[-1] - prop[1]) / sqrt(unpooled_variance) @@ -230,7 +230,7 @@ variance <- sd[-1]^2 / sample_size[-1] + sd[1]^2 / sample_size[1] noncentrality_parameter_se1 <- (mean_change_se1[-1] - mean_change_se1[1]) / - sqrt(variance) + sqrt(variance) marginal_power_se1 <- pnorm( qnorm(alpha, lower.tail = FALSE), @@ -246,7 +246,7 @@ mean_change_se2 <- c(6, 8, 9) noncentrality_parameter_se2 <- (mean_change_se2[-1] - mean_change_se2[1]) / - sqrt(variance) + sqrt(variance) marginal_power_se2 <- pnorm( qnorm(alpha, lower.tail = FALSE), @@ -309,20 +309,20 @@ These are the default outputs from the `graph_calculate_power` function. In addi success_fns <- list( # Probability to reject H1 H1 = function(x) x[1], - + # Expected number of rejections `Expected no. of rejections` = function(x) x[1] + x[2] + x[3] + x[4] + x[5] + x[6], # Probability to reject at least one hypothesis `AtLeast1` = function(x) x[1] | x[2] | x[3] | x[4] | x[5] | x[6], - + # Probability to reject all hypotheses `All` = function(x) x[1] & x[2] & x[3] & x[4] & x[5] & x[6], - + # Probability to reject both H1 and H2 `H1andH2` = function(x) x[1] & x[2], - + # Probability to reject all hypotheses for the low dose or the high dose `(H1andH3andH5)or(H2andH4andH6)` <- function(x) (x[1] & x[3] & x[5]) | (x[2] & x[4] & x[6]) diff --git a/vignettes/comparisons.Rmd b/vignettes/comparisons.Rmd index c9f42642..87ead722 100644 --- a/vignettes/comparisons.Rmd +++ b/vignettes/comparisons.Rmd @@ -60,11 +60,11 @@ for (i in 1:1000) { graph <- random_graph(5) graphicalmcp_weights <- graphicalMCP::graph_generate_weights(graph) dimnames(graphicalmcp_weights) <- list(NULL, NULL) - gmcp_weights <- + gmcp_weights <- gMCP::generateWeights(graph$transitions, graph$hypotheses) gmcp_weights <- gmcp_weights[nrow(gmcp_weights):1, ] # Reorder rows identical <- c( - identical, + identical, all.equal(gmcp_weights, graphicalmcp_weights, tolerance = 1e-7) ) } @@ -83,12 +83,12 @@ identical <- NULL for (i in 1:10000) { graph <- random_graph(5) p <- runif(5, 0, alpha) - graphicalmcp_test_shortcut <- + graphicalmcp_test_shortcut <- graph_test_shortcut(graph, p, alpha = alpha)$outputs$adjusted_p - gmcp_test_shortcut <- + gmcp_test_shortcut <- gMCP(as_graphMCP(graph), p, alpha = alpha)@adjPValues identical <- c( - identical, + identical, all.equal(graphicalmcp_test_shortcut, gmcp_test_shortcut, tolerance = 1e-7) ) } @@ -110,9 +110,9 @@ for (i in 1:1000) { graph <- random_graph(5) marginal_power <- runif(5, 0.5, 0.9) noncentrality_parameter <- - qnorm(1 - 0.025, lower.tail = TRUE) - - qnorm(1 - marginal_power, lower.tail = TRUE) - + qnorm(1 - 0.025, lower.tail = TRUE) - + qnorm(1 - marginal_power, lower.tail = TRUE) + set.seed(1234 + i - 1) graphicalmcp_power <- rbind( graphicalmcp_power, @@ -124,7 +124,7 @@ for (i in 1:1000) { sim_n = 2^17 )$power$power_local ) - + set.seed(1234 + i - 1) gmcp_power <- rbind( gmcp_power, @@ -143,7 +143,7 @@ diff <- data.frame( rbind(graphicalmcp_power, gmcp_power), procedure = rep(c("graphicalMCP", "gMCP"), each = nrow(graphicalmcp_power)) ) - + write.csv( diff, here::here("vignettes/cache/comparisons_power_shortcut.csv"), @@ -156,10 +156,10 @@ gmcp_power <- subset(diff, procedure == "gMCP") round( max( abs( - graphicalmcp_power[, - ncol(graphicalmcp_power)] - - gmcp_power[, - ncol(gmcp_power)] - ) - ), + graphicalmcp_power[, -ncol(graphicalmcp_power)] - + gmcp_power[, -ncol(gmcp_power)] + ) + ), 4 ) # Maximum difference in local power among 1000 cases ``` @@ -170,10 +170,10 @@ round( A successive graph with two primary and two secondary hypotheses will be generated and used for the comparison. A set of p-values is randomly generated to be used for the graphical MCP. Adjusted p-values are calculated and compared using the following functions: `graphicalMCP::graph_test_closure()` and `gMCP::gMCP()`. Parametric tests are used for two primary hypotheses. This process is repeated 10000 times. Adjusted p-values are matched for all 10000 cases. ```{r parametric} -hypotheses <- c(.5, .5, 0, 0) +hypotheses <- c(0.5, 0.5, 0, 0) transitions <- rbind( - c(0, .5, .5, 0), - c(.5, 0, 0, .5), + c(0, 0.5, 0.5, 0), + c(0.5, 0, 0, 0.5), c(0, 1, 0, 0), c(1, 0, 0, 0) ) @@ -183,16 +183,16 @@ set.seed(1234) alpha <- 0.025 identical <- NULL test_corr <- rbind( - c(1, .5, NA, NA), - c(.5, 1, NA, NA), + c(1, 0.5, NA, NA), + c(0.5, 1, NA, NA), c(NA, NA, 1, NA), c(NA, NA, NA, 1) ) for (i in 1:10000) { p <- runif(4, 0, alpha) graphicalmcp_test_parametric <- graph_test_closure( - graph, - p, + graph, + p, alpha = alpha, test_groups = list(1:2, 3:4), test_types = c("parametric", "bonferroni"), @@ -205,7 +205,7 @@ for (i in 1:10000) { correlation = test_corr )@adjPValues identical <- c( - identical, + identical, all.equal(graphicalmcp_test_parametric, gmcp_test_parametric, tolerance = 1e-7) ) } @@ -217,21 +217,21 @@ all(identical) A successive graph with two primary and two secondary hypotheses will be generated and used for the comparison. A set of marginal power (without multiplicity adjustment) is randomly generated. Local power (with multiplicity adjustment) is calculated and compared using the following functions: `graphicalMCP::graph_calculate_power()` and `gMCP::calcPower()`. Parametric tests are used for two primary hypotheses. This process is repeated 100 times. Since different simulation methods are used, results are slightly different. The maximum absolute difference in local power is 0.0142 (1.42%) among 100 cases, which is small. ```{r power-parametric, eval = FALSE} -hypotheses <- c(.5, .5, 0, 0) +hypotheses <- c(0.5, 0.5, 0, 0) transitions <- rbind( - c(0, .5, .5, 0), - c(.5, 0, 0, .5), + c(0, 0.5, 0.5, 0), + c(0.5, 0, 0, 0.5), c(0, 1, 0, 0), c(1, 0, 0, 0) ) graph <- graph_create(hypotheses, transitions) test_corr <- rbind( - c(1, .5, NA, NA), - c(.5, 1, NA, NA), + c(1, 0.5, NA, NA), + c(0.5, 1, NA, NA), c(NA, NA, 1, NA), c(NA, NA, NA, 1) ) -sim_corr <- matrix(.5, 4, 4) +sim_corr <- matrix(0.5, 4, 4) diag(sim_corr) <- 1 set.seed(1234) alpha <- 0.025 @@ -241,7 +241,7 @@ for (i in 1:100) { marginal_power <- runif(4, 0.5, 0.9) noncentrality_parameter <- qnorm(1 - 0.025, lower.tail = TRUE) - - qnorm(1 - marginal_power, lower.tail = TRUE) + qnorm(1 - marginal_power, lower.tail = TRUE) set.seed(1234 + i - 1) graphicalmcp_power_parametric <- rbind( @@ -257,7 +257,7 @@ for (i in 1:100) { sim_n = 2^14 )$power$power_local ) - + set.seed(1234 + i - 1) gmcp_power_parametric <- rbind( gmcp_power_parametric, @@ -277,7 +277,7 @@ diff <- data.frame( rbind(graphicalmcp_power_parametric, gmcp_power_parametric), procedure = rep(c("graphicalMCP", "gMCP"), each = nrow(gmcp_power_parametric)) ) - + write.csv( diff, here::here("vignettes/cache/comparisons_power_parametric.csv"), @@ -290,10 +290,11 @@ gmcp_power <- subset(diff, procedure == "gMCP") round( max( abs( - graphicalmcp_power_parametric[, - ncol(graphicalmcp_power_parametric)] - - gmcp_power_parametric[, - ncol(gmcp_power)] - ) - ), 4 + graphicalmcp_power_parametric[, -ncol(graphicalmcp_power_parametric)] - + gmcp_power_parametric[, -ncol(gmcp_power)] + ) + ), + 4 ) # Maximum difference in local power among 100 cases ``` @@ -303,7 +304,7 @@ round( A successive graph with two primary and two secondary hypotheses will be generated and used for the comparison. A set of p-values is randomly generated to be used for the graphical MCP. Adjusted p-values are calculated and compared using the following functions: `graphicalMCP::graph_test_closure()` and `lrstat::fadjpsim()`. Simes tests are used for two primary hypotheses. This process is repeated 10000 times. Adjusted p-values are matched for all 10000 cases. ```{r simes} -hypotheses <- c(.5, .5, 0, 0) +hypotheses <- c(0.5, 0.5, 0, 0) eps <- 0.0001 transitions <- rbind( c(0, 1 - eps, eps, 0), @@ -324,8 +325,8 @@ family <- rbind( for (i in 1:10000) { p <- runif(4, 0, alpha) graphicalmcp_test_simes <- graph_test_closure( - graph, - p, + graph, + p, alpha = alpha, test_groups = list(1:2, 3:4), test_types = c("simes", "bonferroni") @@ -336,10 +337,10 @@ for (i in 1:10000) { fwgtmat(graph$hypotheses, graph$transitions), p, family - ) - + ) + identical <- c( - identical, + identical, all.equal(graphicalmcp_test_simes, lrstat_test_simes, tolerance = 1e-7) ) } diff --git a/vignettes/generate-closure.Rmd b/vignettes/generate-closure.Rmd index 90e5e7f1..a1a78080 100644 --- a/vignettes/generate-closure.Rmd +++ b/vignettes/generate-closure.Rmd @@ -74,7 +74,7 @@ $m$ is the number of hypotheses. To benchmark against existing approaches to calculating weighting strategies, we compare the following approaches: `gMCP::generateWeights()` [@rohmeyer-2020-gmcp], `lrstat::fwgtmat()` [@lu-2016-graphical], Approach 1 (graphicalMCP simple) and Approach 2 (graphicalMCP parent-child). Random graphs are generated for the numbers of hypotheses of 4, 8, 12, and 16. Computing time (in median log-10 milliseconds) is plotted below. We can see that `gMCP::generateWeights()` is the slowest and `lrstat::fwgtmat()` is the fastest. Approach 2 (graphicalMCP parent-child) is faster than Approach 1 (graphicalMCP simple). Note that `lrstat::fwgtmat()` implements the calculation using C++, which is known to be faster than R. But it is less stable than other approaches, e.g., giving errors more often than others. Given that the computing time of R-based approaches is acceptable, adding Rcpp dependency is not considered in `graphicalMCP`. For these considerations, we implement Approach 2 in `graphicalMCP::graph_generate_weights()`. -![](img/gw-benchmarks-plot.png) +![](img\gw-benchmarks-plot.png) ```{r gw-benchmarks-functions, eval=FALSE} ggw_simple <- function(graph) { @@ -208,7 +208,7 @@ Note that the same step to update the graph may repeat in many replications, whi ```{r power-conventional, eval = FALSE} gcp_conventional <- function( graph, - alpha = .025, + alpha = 0.025, power_marginal = rep(alpha, length(graph$hypotheses)), sim_n = 100, sim_corr = diag(length(graph$hypotheses)), @@ -218,10 +218,10 @@ gcp_conventional <- function( num_hyps <- length(graph$hypotheses) graphicalMCP:::power_input_val( - graph, - sim_n, - power_marginal, - sim_corr, + graph, + sim_n, + power_marginal, + sim_corr, sim_success ) @@ -348,7 +348,7 @@ The small modification in Step 3b makes this approach much faster than the conve To benchmark against existing approaches to calculating weighting strategies, we compare the following approaches: `gMCP::calcPower()`, Approach 1 (graphicalMCP conventional), and Approach 2 (graphicalMCP parent-child). Both Holm and fixed sequence procedures are considered with the numbers of hypotheses of 4, 8, 12, and 16. Computing time (in median log-10 seconds) is plotted below. We can see that `gMCP::calcPower()` is the fastest and Approach 1 (graphicalMCP conventional) is the lowest. Note that `gMCP::calcPower()` implements the simulation using C, which is known to be faster than R but is not easy to extend to other situations. Given that the computing time of Approach 2 (graphicalMCP parent-child) is acceptable, we implement it in `graphicalMCP::graph_calculate_power()`. -![](img/power-benchmarks-plot.png) +![](img\power-benchmarks-plot.png) # Reference @@ -361,30 +361,30 @@ benchmark_list <- lapply( # A graph for the Holm procedure transitions <- matrix(1 / (num_hyps - 1), num_hyps, num_hyps) diag(transitions) <- 0 - + graph <- graph_create(rep(1 / num_hyps, num_hyps), transitions) - + corr <- diag(num_hyps) - + benchmark <- mark( `gMCP (C)` = gMCP::calcPower( - graph$hypotheses, - .025, + graph$hypotheses, + 0.025, graph$transitions, - n.sim = 2^14, + n.sim = 2^14, corr.sim = corr ), - `graphicalMCP conventional (R)` = + `graphicalMCP conventional (R)` = gcp_conventional( - graph, - .025, + graph, + 0.025, power_marginal = rep(.9, num_hyps), sim_n = 2^14 ), `graphicalMCP parent-child (R)` = graph_calculate_power( - graph, - .025, + graph, + 0.025, power_marginal = rep(.9, num_hyps), sim_n = 2^14 ), @@ -393,11 +393,11 @@ benchmark_list <- lapply( time_unit = "s", min_iterations = 5 )[, 1:5] - - benchmark <- benchmark[benchmark$median > .00001, ] + + benchmark <- benchmark[benchmark$median > 0.00001, ] benchmark$char_expression <- as.character(benchmark$expression) benchmark <- benchmark[, c("char_expression", "median")] - + cbind(data.frame(num_hyps = num_hyps), benchmark) } ) @@ -430,26 +430,26 @@ benchmark_list <- lapply( graph <- fixed_sequence(num_hyps) corr <- diag(num_hyps) - + benchmark <- mark( `gMCP (C)` = gMCP::calcPower( - graph$hypotheses, - .025, + graph$hypotheses, + 0.025, graph$transitions, - n.sim = 2^14, + n.sim = 2^14, corr.sim = corr ), - `graphicalMCP conventional (R)` = + `graphicalMCP conventional (R)` = gcp_conventional( - graph, - .025, + graph, + 0.025, power_marginal = rep(.9, num_hyps), sim_n = 2^14 ), `graphicalMCP parent-child (R)` = graph_calculate_power( - graph, - .025, + graph, + 0.025, power_marginal = rep(.9, num_hyps), sim_n = 2^14 ), @@ -458,11 +458,11 @@ benchmark_list <- lapply( time_unit = "s", min_iterations = 5 )[, 1:5] - - benchmark <- benchmark[benchmark$median > .00001, ] + + benchmark <- benchmark[benchmark$median > 0.00001, ] benchmark$char_expression <- as.character(benchmark$expression) benchmark <- benchmark[, c("char_expression", "median")] - + cbind(data.frame(num_hyps = num_hyps), benchmark) } ) @@ -486,7 +486,7 @@ write.csv( ``` ```{r plot-power-benchmarks, fig.dim=c(8, 5), eval=FALSE} -benchmarks_holm <- +benchmarks_holm <- read.csv(here::here("vignettes/cache/power_benchmarks_holm.csv")) benchmarks_fixed_sequence <- read.csv(here::here("vignettes/cache/power_benchmarks_fixed_sequence.csv")) @@ -513,7 +513,7 @@ benchmarks_plot_standard <- geom_line(size = 1) + # scale_y_continuous(labels = scales::label_comma(suffix = "ms")) + scale_color_discrete() + - facet_wrap(~ Procedure, labeller = label_both)+ + facet_wrap(~Procedure, labeller = label_both) + labs( title = "Computing time of power simulations", subtitle = "Median runtime in seconds", diff --git a/vignettes/graph-examples.Rmd b/vignettes/graph-examples.Rmd index ac6033e3..69587b00 100644 --- a/vignettes/graph-examples.Rmd +++ b/vignettes/graph-examples.Rmd @@ -94,7 +94,7 @@ test_results$outputs$rejected Fixed sequence (or hierarchical) procedures pre-specify an order of testing [@maurer-1995-multiple;westfall-2001-optimally]. For example, the procedure will test $H_1$ first. If it is rejected, it will test $H_2$; otherwise the testing stops. If $H_2$ is rejected, it will test $H_3$; otherwise the testing stops. For each hypothesis, it will be tested at the full $\alpha$ level, when it can be tested. -```{r fixed-sequence-1, fig.dim=c(4.5, .9)} +```{r fixed-sequence-1, fig.dim=c(4.5, 0.9)} set.seed(1234) alpha <- 0.025 m <- 3 @@ -106,7 +106,7 @@ fixed_sequence_graph <- fixed_sequence(m) # ) # fixed_sequence_graph <- graph_create(c(1, 0, 0), transitions) -plot(fixed_sequence_graph, nrow = 1, asp = .05, vertex.size = 40) +plot(fixed_sequence_graph, nrow = 1, asp = 0.05, vertex.size = 40) p_values <- runif(m, 0, alpha) @@ -124,7 +124,7 @@ test_results$outputs$rejected Fallback procedures have one-way propagation (like fixed sequence procedures) but allow hypotheses to be tested at different significance levels [@wiens-2003-fixed]. -```{r fallback, fig.dim=c(4.5, .9)} +```{r fallback, fig.dim=c(4.5, 0.9)} set.seed(1234) alpha <- 0.025 m <- 3 @@ -137,7 +137,7 @@ transitions <- rbind( fallback_graph_2003 <- graph_create(rep(1 / m, m), transitions) -plot(fallback_graph_2003, nrow = 1, asp = .05, vertex.size = 40) +plot(fallback_graph_2003, nrow = 1, asp = 0.05, vertex.size = 40) p_values <- runif(m, 0, alpha) @@ -155,7 +155,7 @@ Further they can be improved to allow propagation from later hypotheses to earli hypotheses, because it is possible that a later hypothesis is rejected before an earlier hypothesis can be rejected [@wiens-2005-fallback;@hommel-2008-aesthetics]. -```{r fallback-improved, fig.dim=c(4.5, .9)} +```{r fallback-improved, fig.dim=c(4.5, 0.9)} set.seed(1234) alpha <- 0.025 m <- 3 @@ -171,7 +171,7 @@ fallback_graph_2005 <- graph_create(rep(1 / m, m), transitions) plot( fallback_graph_2005, nrow = 1, - asp = .05, + asp = 0.05, vertex.size = 40, edge_curves = c("pairs" = 7, "H3|H1" = -10) ) @@ -189,8 +189,8 @@ fallback_graph_2008 <- graph_create(rep(1 / m, m), transitions) plot( fallback_graph_2008, nrow = 1, - asp = .05, - eps = .0001, + asp = 0.05, + eps = 0.0001, edge_curves = c("pairs" = 7, "H3|H1" = -10), vertex.size = 40 ) @@ -211,7 +211,7 @@ test_results$outputs$rejected Serial gatekeeping procedures involve ordered multiple families of hypotheses, where all hypotheses of a family of hypotheses must be rejected before proceeding in the test sequence. The example below considers a primary family consisting of two hypotheses $H_1$ and $H_2$ and a secondary family consisting of a single hypothesis $H_3$. In the primary family, the Holm procedure is applied. If both $H_1$ and $H_2$ are rejected, $H_3$ can be tested at level $\alpha$; otherwise $H_3$ cannot be rejected. To allow the conditional propagation to $H_3$, an $\varepsilon$ edge is used from $H_2$ to $H_3$. It has a very small transition weight so that $H_2$ propagates most of its hypothesis weight to $H_1$ (if not already rejected) and retains a small (non-zero) weight for $H_3$ so that if $H_1$ has been rejected, all hypothesis weight of $H_2$ will be propagated to $H_3$. Here $\varepsilon$ is assigned to be 0.0001 and in practice, the value could be adjusted but it should be much smaller than the smallest p-value observed. -```{r serial-gatekeeping, fig.dim=c(4.5, .9)} +```{r serial-gatekeeping, fig.dim=c(4.5, 0.9)} set.seed(1234) alpha <- 0.025 m <- 3 @@ -228,8 +228,8 @@ serial_gatekeeping_graph <- graph_create(c(0.5, 0.5, 0), transitions) plot( serial_gatekeeping_graph, nrow = 1, - asp = .05, - eps = .0001, + asp = 0.05, + eps = 0.0001, edge_curves = c("pairs" = 7, "H3|H1" = -10), vertex.size = 40 ) @@ -298,7 +298,7 @@ transitions <- rbind( parallel_gatekeeping_improved_graph <- graph_create(c(0.5, 0.5, 0, 0), transitions) -plot(parallel_gatekeeping_improved_graph, eps = .0001, vertex.size = 70) +plot(parallel_gatekeeping_improved_graph, eps = 0.0001, vertex.size = 70) p_values <- runif(m, 0, alpha) @@ -352,7 +352,7 @@ m <- 4 successive_var <- simple_successive_var <- function(gamma) { graph_create( - c(.5, .5, 0, 0), + c(0.5, 0.5, 0, 0), rbind( c(0, gamma, 1 - gamma, 0), c(gamma, 0, 0, 1 - gamma), diff --git a/vignettes/graphicalMCP.Rmd b/vignettes/graphicalMCP.Rmd index e031160c..a52d3c47 100644 --- a/vignettes/graphicalMCP.Rmd +++ b/vignettes/graphicalMCP.Rmd @@ -71,8 +71,9 @@ Given the set of p-values of all hypotheses, graphical MCPs can be performed usi ```{r test-graph-shortcut} test_results <- graph_test_shortcut( example_graph, - p = c(.01, .005, .03, .01), - alpha = .025) + p = c(0.01, 0.005, 0.03, 0.01), + alpha = 0.025 +) test_results$outputs$rejected ``` @@ -81,8 +82,8 @@ A similar testing procedure can be performed using the closure principle. This w ```{r test-graph} test_results_closed <- graph_test_closure( example_graph, - p = c(.01, .005, .03, .01), - alpha = .025, + p = c(0.01, 0.005, 0.03, 0.01), + alpha = 0.025, test_types = "bonferroni", test_groups = list(1:4) ) @@ -91,14 +92,14 @@ test_results_closed$outputs$rejected # Power simulations -With multiplicity adjustment, such as graphical MCPs, the "power" to reject each hypothesis will be affected, compared to its marginal power. The latter is the power to rejected a hypothesis at the significance level `alpha` without multiplicity adjustment. The marginal power is usually obtained from other pieces of statistical software. `graph_calculate_power()` performs power simulations to assess the power after adjusting for the graphical MCP [@bretz-2011-test]. Assume that the marginal power to reject H1-H4 is 90%, 90%, 80%, and 80% and all test statistics are independent of each other. The local power after the multiplicity adjustment is 87.7%, 87.7, 67.2%, and 67.2% respectively for H1-H4. Additional details about power simulations can be found in `vignette("shortcut-testing")` and `vignette("closed-testing")`. +With multiplicity adjustment, such as graphical MCPs, the "power" to reject each hypothesis will be affected, compared to its marginal power. The latter is the power to rejected a hypothesis at the significance level `alpha` without multiplicity adjustment. The marginal power is usually obtained from other pieces of statistical software. `graph_calculate_power()` performs power simulations to assess the power after adjusting for the graphical MCP [@bretz-2011-test]. Assume that the marginal power to reject H1-H4 is 90%, 90%, 80%, and 80% and all test statistics are independent of each other. The local power after the multiplicity adjustment is 87.7%, 87.7%, 67.2%, and 67.2% respectively for H1-H4. Additional details about power simulations can be found in `vignette("shortcut-testing")` and `vignette("closed-testing")`. ```{r power} set.seed(1234) power_results <- graph_calculate_power( example_graph, sim_n = 1e6, - power_marginal = c(.9, .9, .8, .8) + power_marginal = c(0.9, 0.9, 0.8, 0.8) ) power_results$power$power_local ``` diff --git a/vignettes/man/figures/README-create-graph-1.png b/vignettes/man/figures/README-create-graph-1.png deleted file mode 100644 index c8cd4b33..00000000 Binary files a/vignettes/man/figures/README-create-graph-1.png and /dev/null differ diff --git a/vignettes/shortcut-testing.Rmd b/vignettes/shortcut-testing.Rmd index 7432f6c4..335e7cf5 100644 --- a/vignettes/shortcut-testing.Rmd +++ b/vignettes/shortcut-testing.Rmd @@ -58,7 +58,7 @@ plot(g, vertex.size = 60) Given a set of p-values for $H_1, \ldots, H_4$, the graphical multiple comparison procedure can be performed to control the familywise error rate (FWER) at the significance level `alpha`. The `graph_test_shortcut` function is agnostic to one-sided or two-sided tests. For one-sided p-values, `alpha` is often set to 0.025 (default); for two-sided p-values, `alpha` is often set to 0.05. We consider one-sided tests here. A hypothesis is rejected if its adjusted p-value is less than or equal to `alpha`. After running the procedure, hypotheses $H_1$, $H_2$, and $H_4$ are rejected with their adjusted p-value calculated. ```{r graph-test} -p_values <- c(.018, .01, .105, .006) +p_values <- c(0.018, 0.01, 0.105, 0.006) test_results <- graph_test_shortcut(g, p = p_values, alpha = 0.025) test_results$outputs$adjusted_p # Adjusted p-values @@ -93,7 +93,7 @@ The order of rejections may not be unique and not all orders are valid. For this ```{r graph-test-order} # Obtain all valid orders of rejections -orders <- graph_rejection_orderings(test_results)$valid_orderings +orders <- graph_rejection_orderings(test_results)$valid_orderings orders # Intermediate graphs following the order of H2 and H4 @@ -130,7 +130,7 @@ sample_size <- rep(200, 3) unpooled_variance <- prop[-1] * (1 - prop[-1]) / sample_size[-1] + - prop[1] * (1 - prop[1] ) / sample_size[1] + prop[1] * (1 - prop[1]) / sample_size[1] noncentrality_parameter_primary <- -(prop[-1] - prop[1]) / sqrt(unpooled_variance) @@ -208,19 +208,19 @@ These are the default outputs from the `graph_calculate_power` function. In addi success_fns <- list( # Probability to reject H1 H1 = function(x) x[1], - + # Expected number of rejections `Expected no. of rejections` = function(x) x[1] + x[2] + x[3] + x[4], # Probability to reject at least one hypothesis `AtLeast1` = function(x) x[1] | x[2] | x[3] | x[4], - + # Probability to reject all hypotheses `All` = function(x) x[1] & x[2] & x[3] & x[4], - + # Probability to reject both H1 and H2 `H1andH2` = function(x) x[1] & x[2], - + # Probability to reject both hypotheses for the low dose or the high dose `(H1andH3)or(H2andH4)` = function(x) (x[1] & x[3]) | (x[2] & x[4]) ) @@ -234,7 +234,7 @@ Given the above inputs, we can estimate "power" via simulation for the graphical set.seed(1234) power_output <- graph_calculate_power( g, - alpha = .025, + alpha = 0.025, sim_corr = corr, sim_n = 1e5, power_marginal = c(power_marginal_primary, power_marginal_secondary), @@ -253,7 +253,7 @@ To see the detailed outputs of all simulated p-values and rejection decisions fo set.seed(1234) power_verbose_output <- graph_calculate_power( g, - alpha = .025, + alpha = 0.025, sim_corr = corr, sim_n = 1e5, power_marginal = c(power_marginal_primary, power_marginal_secondary),