expected.pd: Expected PD, PD Variance, and Edge Abundance Distribution of...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/expected.pd.R

Description

Calculates the expected phylogenetic diversity (Faith's PD) and variance of PD under binomial sampling with a fixed probability of each tip being sampled, and the Edge-length Abundance Distribution of a phylogeny.

Usage

1
2
3
expected.pd(phy)
variance.pd(phy, upper.bound=TRUE)
ead(phy)

Arguments

phy

phylo object

upper.bound

Calculate upper bound of PD variance? (default = TRUE)

Details

The function expected.pd calculates the expected phylogenetic diversity (Faith's PD - total branch length) for all subsets of a phylogeny, based on an analytic solution for expected PD.

The function variance.pd additionally calculates the variance of expected PD for all subsets of a phylogeny, based on an analytic solution for expected PD. If argument upper.bound=TRUE, a fast solution for the upper bound of the variance is returned. Otherwise, the exact solution for the variance is returned. Note that the exact solution is much slower than the upper bound solution.

The function ead calculates the edge abundance distribution (EAD), the length of edges with different numbers of descendant tips.

Value

n

Expected Number of tips sampled

expected.pd

Expected PD for a given n

variance.pd

Variance of PD for a given n

num.children

Number of tips descended from an edge

edge.length

Total phylogenetic edge length for a given number of tips descended from an edge

Author(s)

Steven Kembel <steve.kembel@gmail.com> and James O'Dwyer <jodwyer@santafe.edu>

References

J.P. O'Dwyer, S.W. Kembel, and J.L. Green. 2012. Phylogenetic Diversity Theory Sheds Light on the Structure of Microbial Communities. PLoS Comput Biol 8(12): e1002832.

See Also

pd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
randtree <- rcoal(300)
randtree.pd.ub <- variance.pd(randtree, upper.bound=TRUE)
randtree.pd.exact <- variance.pd(randtree, upper.bound=FALSE)
plot(expected.pd(randtree), xlab="Number of tips",
    ylab="Phylogenetic diversity (PD)", type="l", log="xy")
lines(randtree.pd.exact$expected.pd+1.96*sqrt(randtree.pd.exact$variance.pd), lty=2)
lines(randtree.pd.exact$expected.pd-1.96*sqrt(randtree.pd.exact$variance.pd), lty=2)
lines(randtree.pd.ub$expected.pd+1.96*sqrt(randtree.pd.ub$variance.pd), lty=3)
lines(randtree.pd.ub$expected.pd-1.96*sqrt(randtree.pd.ub$variance.pd), lty=3)
legend("bottomright", lty=c(1,2,3), legend=c("Expected PD",
    "95 percent CI (exact)","95 percent CI (upper bound)"))

Example output

Loading required package: ape
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-4
Loading required package: nlme

picante documentation built on July 1, 2020, 10:57 p.m.