Learn R Programming

apTreeshape (version 1.5-0.1)

cladesize: Compute the number of children of a randomly chosen node

Description

cladesize takes a random internal node in a tree, and computes its number of descendants (clade size).

Usage

cladesize(tree)

Arguments

tree

An object of class "treeshape".

Value

An object of class numeric representing the clade size of a random node of a tree.

Details

This function can be used to check whether a tree fits the Yule or the PDA models. Under the Yule model, the probability distribution of the random clade size is equal to $$P(Kn=k)=\frac{2n}{(n-1)k(k+1)}$$ for \(k = 2, 3, \ldots, n-1\) and $$P(Kn=n)=\frac{1}{n-1}$$ (where \(n\) is the number of tips of the tree and \(Kn\) is the number of descendents of an internal node of the tree). Under the PDA model, the asymptotic distribution (when the number of tips grows to infinity) of the random clade size is equal to $$P(K=k+1)=\frac{{2k\choose k}}{(k+1)(2^k)^2}$$.

References

Blum, M., Francois, O. and Janson, S. The mean, variance and limiting distribution of two statistics sensitive to phylogenetic tree balance; manuscript available from http://www-timc.imag.fr/Olivier.Francois/bfj.pdf.

Examples

Run this code
# NOT RUN {
# Histogram of random clade sizes 
main="Random clade sizes for random generated trees"
xlabel="clade size"
hist(sapply(rtreeshape(100,tip.number=40,model="yule"),FUN=cladesize),
      freq=FALSE,main=main,xlab=xlabel)
# }

Run the code above in your browser using DataLab