Skip to contents

Test the hypothesis that two clades within a tree were generated by the same coalescent process.

Usage

treestructure.test(tre, x, y, nsim = 10000)

Arguments

tre

An ape::phylo tree, must be binary and rooted

x

A character vector of tip labels or numeric node numbers. If numeric, can include internal node numbers.

y

as x, but must be disjoint with x

nsim

Number of simulations (larger = slower and more accurate)

Examples

tree <- ape::read.tree( system.file('sim.nwk', package = 'treestructure') )

(struc <- trestruct( tree ))
#> Tree has NA or duplicated tip labels. Adding a unique id.
#> Finding splits under nodes: 276 
#> Finding splits under nodes: 276 526 
#> Finding splits under nodes: 276 421 
#> Finding splits under nodes: 276 473 
#> Call: 

#> .trestruct(tre = tre, minCladeSize = minCladeSize, minOverlap = minOverlap, 
#>     nodeSupportValues = nodeSupportValues, nodeSupportThreshold = nodeSupportThreshold, 
#>     nsim = nsim, level = level[1], ncpu = ncpu, verbosity = verbosity, 
#>     debugLevel = debugLevel, useNodeSupport = useNodeSupport, 
#>     tredat = tredat)
#> 

#> Significance level: 0.01 
#> Number of clusters: 4 
#> Number of partitions: 2 
#> Number of taxa in each cluster:
#> 
#>   1   2   3   4 
#>  25  25 200  25 
#> Number of taxa in each partition:
#> 
#>   1   2 
#>  75 200 
#> ...

#> For complete data, use `as.data.frame(...)` 

#run the test

results <- treestructure.test(tree, x = struc$clusterSets[[1]],
                              y = struc$clusterSets[[2]])
#> Tree has NA or duplicated tip labels. Adding a unique id.

print(results)
#>      Treestructure rank-sum test
#>      
#> data: 
#> Phylogenetic tree with 275 tips and 274 internal nodes.
#> 
#> Tip labels:
#>   1_1, 2_1, 3_1, 4_1, 5_1, 6_1, ...
#> 
#> Rooted; includes branch length(s).
#> Rank sum = 638, p-value = 0.1504
#> Alternative hypothesis: Rank sum differs from coalescent distribution
#> 95 percent confidence interval:
#>   492  682