smaller.clade.spectrum: Compute the smaller clade spectrum of a tree.

Description Usage Arguments Value Author(s) See Also Examples

Description

smaller.clade.spectrum returns a n*2 matrix where n is the number of internal nodes of the tree. For each i in 1:n, the [i,1] element of the matrix is the size of the clade rooted at the 'i'th node of the tree. [i,2] is the size of the smaller daughter clade of the 'i'th node of the tree.

Usage

1

Arguments

tree

An object of class "treeshape".

Value

A n*2 matrix (where n is the number of internal nodes of the tree) containing the size of the clades and the smaller clades. smaller.clade.spectrum(tree)[1,1] contains the number of tips of the tree. smaller.clade.spectrum(tree)[i,1] contains the number of tips of the subtree whose root is the node number n-i+1. smaller.clade.spectrum(tree)[1,2] contains the number of tips of the smaller daughter clade at the root.

Author(s)

Michael Blum <michael.blum@imag.fr>
Nicolas Bortolussi <nicolas.bortolussi@imag.fr>
Eric Durand <eric.durand@imag.fr>
Olivier Francois <olivier.franois@imag.fr>

See Also

spectrum.treeshape

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# computes the log-likelihood for Aldous' model
shape.new <- function(tree){
h <- function(n){sum(1/(1:n))}
mat <- smaller.clade.spectrum(tree)
parent <- mat[,1]
daughter <- mat[,2]
nh.n <- sapply(parent, FUN = function(x){x*h(x-1)} )
s <- sum(log(daughter/parent) + log(1 - daughter/parent) + log(nh.n))
return(s)}
 
# distribution over 200 replicates

tr <- rtreeshape(200, 100, FUN =
function(n,i){if((i>0)&(i<n))return(1/i/(n-i)) else return(0)})
res <- sapply( tr, FUN = shape.new)  
hist(res)

bcm-uga/apTreeshape documentation built on Sept. 26, 2019, 4:56 p.m.