phylodiv.expected: Expected Phylogenetic Diversity of ecological samples

Description Usage Arguments Details Value References Examples

View source: R/phylodiv_expected.R

Description

Calculates the expected Phylogenetic Diversity (PD) of multiple samples simultaneously based on probabilities of occurrence (or extinction) for each combination of species and site. Note that this function uses that version of PD that always includes the path to the root of the tree.

Usage

1
phylodiv.expected(x, phy, occur = TRUE)

Arguments

x

is the community data given as a data.frame or matrix with species/OTUs as columns and samples/sites as rows (like in the vegan package). Columns are labelled with the names of the species/OTUs. Rows are labelled with the names of the samples/sites. Data are expressed as probabilities (ranging 0-1) of either occurrence or extinction. Column labels must match tip labels in the phylogenetic tree exactly!

phy

is a rooted phylogenetic tree with branch lengths stored as a phylo object (as in the ape package) with terminal nodes labelled with names matching those of the community data table. Note that the function trims away any terminal taxa not present in the community data table, so it is not necessary to do this beforehand.

occur

is a logical indicating whether x is a matrix of probabilities of occurrence (TRUE - default) or extinction (FALSE)

Details

phylodiv.expected takes probability data and a phylogenetic tree (rooted and with branch lengths) and calculates the expected Phylogenetic Diversity (PD) of all samples/sites. PD is defined as the total length of all branches spanning a set of terminal taxa representing an ecological sample (Faith, 1992). Expected PD is the summed branch length expected for each site given the probability of occurrence (or extinction) of species (and ancestral branches) at that site (Witting & Loeschcke 1995; Faith 2013). Please note that, if the common ancestor (node) of the set of taxa of a sample is not the root of the tree, then the set of branches connecting this node to the root are also included in the calculation.

Value

A vector of expected Phylogenetic Diversity (PD) values for each sample/site in x.

References

Examples

1
2
3
4
x <- matrix(data=c(0.8,0.6,0.2,0.2,0.9,0.1,0.1,0.8,0.9),nrow=3,ncol=3)
colnames(x) <- c("A","B","C")
phy <- read.tree(text="((A:1,B:1):1,C:2);")
phylodiv.expected(x,phy,occur=TRUE)

davidnipperess/PDcalc documentation built on July 1, 2018, 3:59 p.m.