View source: R/hierarchical_test.R
hierarchical_test | R Documentation |
This function sequentially tests on a tree in a top-down manner. The testing result determines aggregation of the leaves and makes sure the False Split Rate is controlled under a target level.
hierarchical_test(tree = NULL, p_vals, alpha, independent = TRUE)
tree |
An object encoding the tree structure. Can be one of three
formats: (1) an |
p_vals |
A length- |
alpha |
A use-specified target FSR level |
independent |
Whether the p-values are independent (default = TRUE). |
Returns the testing result and calculated threshold values.
alpha |
The target FSR level. |
rejections |
A length- |
threshold_functions |
A length-( |
groups |
A length- |
set.seed(123)
## Example 1: Test with an hclust object
hc = hclust(dist((1:10) + runif(10)/10), method = "complete")
p_vals = c(runif(5), rbeta(4, 1, 60))
hierarchical_test(tree = hc, p_vals = p_vals, alpha = 0.3, independent = TRUE)
## Example 2: Test with a dendrogram object
dend = as.dendrogram(hc)
p_vals = c(runif(4), rbeta(1, 1, 60), runif(1), rbeta(3, 1, 60))
hierarchical_test(tree = dend, p_vals = p_vals, alpha = 0.3, independent = TRUE)
## Example 3: Test with a hc_list object
hc_list = dend_as_hclist(dend)
p_vals = c(runif(4), rbeta(1, 1, 60), runif(1), rbeta(3, 1, 60))
hierarchical_test(tree = hc_list, p_vals = p_vals, alpha = 0.3, independent = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.