treediff | R Documentation |
Perform the treediff test to compare two sets of trees.
treediff(trees1, trees2, replicates, scale = FALSE, order_labels = FALSE)
## S3 method for class 'treeTest'
print(x, ...)
## S3 method for class 'treeTest'
summary(object, ...)
trees1 |
A list of trees corresponding to the first condition (set). Trees are structured into groups (or clusters) with the same number of replicates in each group. Trees are ordered by groups and then by replicates: {group1+rep1, group1+rep2, ...}. One test is performed for each group. |
trees2 |
A list of trees corresponding to the second condition. Trees
are also structured in groups (or clusters) that are exactly the same than
for the first condition. The number of replicates in each group can be
different from that of |
replicates |
A numeric vector of length 2 with the number of replicates for each condition. |
scale |
Logical. If |
order_labels |
Logical. If |
x |
a |
... |
not used |
object |
a |
This function compares two sets of trees using a p-value aggregation method. The p-values are obtained by the treediff method, as described in (Neuvial et al., 2023).
An object of class treeTest
with the following entries:
p.value |
the p-value for the treediff test. |
statistic |
the value of the Student's statistic of each leaf pair of the tree test. |
p.value.indiv |
the p-value of the Student's test for each leaf pair of the tree test. |
method |
a character string indicating what type of test was performed. |
data.name |
a character string giving the names of the tree conditions. |
Gwendaëlle Cardenas
Marie Chavent marie.chavent@u-bordeaux.fr
Sylvain Foissac sylvain.foissac@inrae.fr
Pierre Neuvial pierre.neuvial@math.univ-toulouse.fr
Nathanaël Randriamihamison
Nathalie Vialaneix nathalie.vialaneix@inrae.fr
Neuvial Pierre, Randriamihamison Nathanaël, Chavent Marie, Foissac Sylvain and Vialaneix Nathalie (2024) A two-sample tree-based test for hierarchically organized genomic signals. Journal of the Royal Statistical Society, Series C, Forthcoming.
leaves <- c(100, 120, 50, 80)
trees <- sapply(leaves, FUN = function(leaf) {
base_data <- matrix(rnorm(2000), nrow = leaf, ncol = 200)
## generates two sets of trees with 4 clusters with 100, 120, 50 and 80
## leaves respectively
## 4 replicates in the first condition and 6 in the second condition
set1 <- replicate(4, sample(1:100, 50, replace = FALSE))
set2 <- replicate(6, sample(101:200, 50, replace = FALSE))
trees1 <- apply(set1, 2, function(asample) {
samples <- base_data[, asample]
out <- hclust(dist(samples), method = "ward.D2")
return(out)
})
trees2 <- apply(set2, 2, function(asample) {
samples <- base_data[, asample]
out <- hclust(dist(samples), method = "ward.D2")
return(out)
})
return(list("trees1" = trees1, "trees2" = trees2))
})
trees1 <- unlist(trees[1, ], recursive = FALSE)
trees2 <- unlist(trees[2, ], recursive = FALSE)
replicates <- c(4, 6)
tree_pvals <- treediff(trees1, trees2, replicates)
## 4 p-values, one for each cluster
tree_pvals$p.value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.