Skip to content

Commit

Permalink
Fix docs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
EeethB committed May 1, 2024
1 parent bbfc847 commit 9a70691
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/edge_pairs.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#' Find pairs of vertices that are connected in both directions
#'
#' @param graph An initial graph as returned by [graph_create()].
#'
#' @return A list of vertex pairs which are connected in both directions. NULL
#' if no such pairs are found
edge_pairs <- function(graph) {
g_names <- names(graph$hypotheses)

Expand Down
51 changes: 51 additions & 0 deletions R/test_power_input_val.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
#' Validate inputs for testing and power simulations
#'
#' @param graph An initial graph as returned by [graph_create()].
#' @param p A numeric vector of p-values (unadjusted, raw), whose values should
#' be between 0 & 1. The length should match the number of hypotheses in
#' `graph`.
#' @param alpha A numeric value of the overall significance level, which should
#' be between 0 & 1. The default is 0.025 for one-sided hypothesis testing
#' problems; another common choice is 0.05 for two-sided hypothesis testing
#' problems. Note when parametric tests are used, only one-sided tests are
#' supported.
#' @param test_groups A list of numeric vectors specifying hypotheses to test
#' together. Grouping is needed to correctly perform Simes and parametric
#' tests.
#' @param test_types A character vector of test types to apply to each test
#' group. This is needed to correctly perform Simes and parametric
#' tests. The length should match the number of elements in `test_groups`.
#' @param test_corr (Optional) A list of numeric correlation matrices. Each
#' entry in the list should correspond to each test group. For a test group
#' using Bonferroni or Simes tests, its corresponding entry in `test_corr`
#' should be `NA`. For a test group using parametric tests, its
#' corresponding entry in `test_corr` should be a numeric correlation matrix
#' specifying the correlation between test statistics for hypotheses in this
#' test group. The length should match the number of elements in
#' `test_groups`.
#' @param verbose A logical scalar specifying whether the details of the
#' adjusted p-value calculations should be included in results. When
#' `verbose = TRUE`, adjusted p-values are provided for each intersection
#' hypothesis. The default is `verbose = FALSE`.
#' @param test_values A logical scalar specifying whether adjusted significance
#' levels should be provided for each hypothesis. When `test_values = TRUE`,
#' it provides an equivalent way of performing graphical multiple comparison
#' procedures by comparing each p-value with its significance level. If the
#' p-value of a hypothesis is less than or equal to its significance level,
#' the hypothesis is rejected. The default is `test_values = FALSE`.
#' @param sim_n An integer scalar specifying the number of simulations. The
#' default is 1e5.
#' @param power_marginal A numeric vector of marginal power values to use when
#' simulating p-values. See Details for more on the simulation process.
#' @param success A list of user-defined functions to specify the success
#' criteria. Functions must take one simulation's logical vector of results as
#' an input, and return a length-one logical vector. For instance, if
#' "success" means rejecting hypotheses 1 and 2, use `sim_success = list("1
#' and 2" = function(x) x[1] && x[2])`. If the list is not named, the function
#' body will be used as the name. Lambda functions also work starting with R
#' 4.1, e.g. `sim_success = list(\(x) x[3] || x[4])`.
#'
#' @return Returns `graph` invisibly
#'
#' @rdname input_val
test_input_val <- function(graph,
p,
alpha,
Expand Down Expand Up @@ -94,6 +144,7 @@ test_input_val <- function(graph,
invisible(graph)
}

#' @rdname input_val
power_input_val <- function(graph, sim_n, power_marginal, test_corr, success) {
num_hyps <- length(graph$hypotheses)

Expand Down
18 changes: 18 additions & 0 deletions man/edge_pairs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions man/input_val.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a70691

Please sign in to comment.