pd.calc: Calculate and bootstrap phylogenetic diversity measurements.

Description Usage Arguments Details Value Author(s) References Examples

Description

These functions calculate various phylogenetic diversity measures for either a given set of nodes on a tree or for a randomly chosen set of nodes of a given size. The ed.calc function calculates a related species-level measurement of evolutionary distinctness.

Usage

1
2
3
pd.calc(cm, tip.subset = NULL, method = "TBL", root.edge=FALSE)
pd.bootstrap(cm, ntips, reps = 1000, method = "TBL", tip.weights = NULL)
ed.calc(cm, polytomy.cf=c("isaac","mooers","none"))

Arguments

cm

A object of class 'clade matrix'. Alternatively an object of class 'phylo', which will be converted to a clade.matrix.

tip.subset

An optional vector identifying the subset of tips to use for PD calculations. If no tip.subset is provided the method is applied to the complete phylogeny [Hmm.. this might be undesirable]. Can either be a character vector, in which case the elements are matched against tip labels, or a vector of positive integers in the range 1 to the number of tips, in which case the tips with those numbers are used.

method

One of 'TBL', 'MST', 'UEH', 'SBL', defaulting to 'TBL'. See details.

root.edge

Logical indicating whether to include the root edge length in calculations, defaulting to FALSE.

ntips

A single integer giving the number of tips to be selected.

reps

The number of replicate values to calculate.

tip.weights

A numeric vector containing weights for all the tips in the phylogeny. Each element must be named in order to match weights to the tips.

polytomy.cf

Which correction factor to use for calculating ED at polytomies. One of 'isaac', 'mooers' or 'none'.

Details

There are five implemented PD measures:

Total Branch Length (TBL)

The sum of all the edge lengths in the subtree given by the tip subset. This measure can be partitioned into the two next measures.

Shared Branch Length (SBL)

The sum of all edges in the subtree that are shared by more than one tip.

Unique Evolutionary History (UEH)

The sum of the edge lengths that give rise to only one tip in the subtree.

Length of tip branch lengths (TIPS)

Length of tip branch lengths (TIPS)

Unlike UEH, this measure does not use the unique paths to each tips on the subtree and instead gives the sum of the unique branches leading to the tips on the complete tree.

Minimum Spanning Tree (MST)

The sum of the lengths of the edges for the smallest tree that links the subset tips, excluding any edges below the node of the most recent common ancestor.

These options are illustrated in the caper package vignette. The pd.calc function returns the PD value for a given set of tips, whereas the pd.bootstrap function returns a vector of PD values for randomly selected sets of tips of a given size.

The ed.calc function returns the evolutionary distinctness (ED) metric (Isaac et al, 2007) for the tips of a given phylogeny. The idea behind the ED measure is that the evolutionary history of each branch is shared equally between all tips descending from that branch. Each branch therefore has a per-tip values of the branch length divided by the number of descendants and the ED value for a tip is the sum of those per-tip contributions over the path to the root of the phylogeny. Polytomies inflate apparent ED since the branches of a properly resolved polytomy must be shorter than the branch lengths on the unresolved polytomy. The function provides two correction factors for this: 'isaac' uses a correction factor calibrated from simulations and 'mooers' uses empirical predictions from a pure birth model.

Value

Both pd.calc and pd.bootstrap return a vector containing either a single value for the phylogenetic diversity of a given set of tips or a vector of length 'nrep' containing the pd values for a random set of tips of a given size. The method used is stored in the 'pd.method' attribute of the vector.

The ed.calc function returns a list containing:

branch

A data frame of the ED contributions arising from each branch.

spp

A data frame of the summed ED contributions for each species.

Author(s)

David Orme, Gavin Thomas, Nick Isaac

References

Faith, DP, Isaac, N. J. B., Turvey, S. T., Collen, B., Waterman, C., and Baillie, J. E. M. (2007). Mammals on the edge: Conservation priorities based on threat and phylogeny. Plos One, 2(3):e296

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
treeString <- paste('((((A:1,B:1):1.5,C:2.5):0.5,(D:0.6,E:0.6):2.4):0.5,',
                    '((F:1.9,G:1.9):0.8,(H:1.6,I:1.6):1.1):0.8):0.2;' ,sep='')
tre <- read.tree(text=treeString)
clmat <- clade.matrix(tre)
tips <- c("A","C","D","E","G","H")
pd.calc(clmat, tip.subset=tips)
pd.calc(clmat, tip.subset=c(1,3,4,5,7,8))
pd.calc(clmat, tip.subset=tips, root.edge=TRUE)

pd.bootstrap(clmat, ntips=6, reps=1000, method='TBL')

data(IsaacEtAl)
primatesCM <- clade.matrix(primates.tree)
primatesED <- ed.calc(primatesCM)

Example output

Loading required package: ape
Loading required package: MASS
Loading required package: mvtnorm
[1] 15.8
attr(,"pd.method")
[1] "TBL"
[1] 15.8
attr(,"pd.method")
[1] "TBL"
[1] 16
attr(,"pd.method")
[1] "TBL"
   [1] 14.8 15.2 15.8 17.1 14.3 15.8 17.1 14.1 15.1 13.2 15.8 15.0 15.8 16.8
  [15] 15.1 16.8 14.2 16.8 14.9 16.2 15.7 14.9 15.3 16.2 15.8 14.1 14.3 15.2
  [29] 14.1 14.3 15.8 15.8 15.2 17.1 15.0 15.0 13.2 16.2 17.1 15.1 16.2 16.2
  [43] 14.8 15.2 14.3 14.9 16.2 16.2 16.8 15.4 13.5 15.4 16.2 15.2 15.0 16.8
  [57] 15.2 14.9 16.8 15.3 16.8 16.8 15.1 14.9 16.2 14.8 15.1 15.4 15.6 17.1
  [71] 14.1 17.1 15.6 15.2 16.2 15.8 15.0 15.8 15.3 15.1 15.6 15.1 14.9 17.1
  [85] 15.6 14.9 15.2 15.1 17.1 14.1 15.7 16.2 13.8 14.9 15.2 14.7 16.8 16.8
  [99] 16.2 15.1 14.9 15.8 17.1 16.2 16.2 16.2 16.2 16.8 15.2 14.3 15.3 13.8
 [113] 14.7 15.3 16.8 14.9 15.2 17.1 15.8 15.3 15.6 15.1 15.2 15.8 15.3 16.2
 [127] 14.8 16.2 15.1 15.7 16.2 14.1 17.1 16.2 15.2 14.8 17.1 15.6 16.2 16.2
 [141] 15.8 13.8 15.3 15.2 14.1 14.3 17.1 14.7 15.8 17.1 15.2 14.9 14.9 14.3
 [155] 16.2 17.1 15.6 16.8 14.1 15.2 14.9 15.1 14.9 16.2 17.1 15.8 15.3 13.8
 [169] 16.2 14.9 16.8 15.6 15.0 15.2 14.9 14.3 15.8 15.1 16.2 14.7 15.1 16.2
 [183] 16.2 15.3 16.2 15.0 15.8 15.6 13.2 16.2 14.1 16.2 14.3 16.2 17.1 17.1
 [197] 13.8 16.2 16.8 16.2 16.8 16.2 15.4 15.4 15.6 17.1 16.2 15.8 15.3 15.8
 [211] 15.8 15.8 15.7 15.1 15.4 15.6 15.3 15.1 15.8 15.8 17.1 14.3 15.2 16.2
 [225] 14.1 16.2 15.8 14.3 17.1 14.8 16.2 15.2 17.1 15.3 16.8 14.3 13.2 14.9
 [239] 14.2 15.1 15.6 15.2 15.6 16.2 16.2 15.2 16.8 15.8 16.8 15.1 17.1 15.4
 [253] 14.1 16.2 15.6 14.8 16.8 15.2 14.3 16.8 15.6 16.2 14.9 17.1 15.7 15.8
 [267] 13.8 15.2 15.8 14.9 17.1 16.2 15.1 16.2 17.1 15.3 15.2 13.5 14.7 15.4
 [281] 14.3 15.3 16.2 16.8 14.1 16.2 14.7 15.2 14.8 15.2 16.2 15.2 15.6 16.2
 [295] 15.4 16.2 14.7 16.8 15.2 16.2 15.1 14.9 16.2 14.9 17.1 16.8 16.2 14.3
 [309] 15.3 14.3 13.2 16.2 15.8 14.1 15.2 15.8 17.1 17.1 14.7 15.1 16.8 16.8
 [323] 15.1 15.6 15.2 16.2 16.2 16.2 17.1 17.1 14.2 14.7 16.2 14.3 16.2 14.3
 [337] 15.8 14.8 16.2 15.7 16.8 15.1 17.1 16.2 15.6 16.2 15.8 14.3 14.8 16.8
 [351] 14.9 16.8 15.8 14.7 16.2 15.0 15.2 13.5 15.8 15.0 16.2 15.8 14.3 14.7
 [365] 15.2 15.0 15.8 15.0 14.9 15.8 14.3 15.1 15.1 16.2 16.2 15.1 17.1 15.2
 [379] 17.1 14.3 14.9 16.2 16.2 17.1 16.2 15.2 15.6 15.8 16.2 16.8 14.2 15.8
 [393] 15.0 15.8 16.8 15.2 15.8 16.2 15.6 16.2 14.1 17.1 15.1 17.1 14.1 16.2
 [407] 16.2 14.9 15.1 17.1 17.1 15.3 15.6 15.2 15.3 14.9 15.2 16.2 14.3 14.1
 [421] 14.9 16.2 16.8 13.2 14.2 15.8 15.8 16.8 15.3 15.8 17.1 15.7 15.7 15.3
 [435] 17.1 16.2 16.8 16.8 17.1 15.1 15.3 16.8 15.8 15.1 15.8 15.3 16.2 17.1
 [449] 17.1 16.8 15.1 16.8 16.2 14.3 15.8 15.8 14.9 15.8 16.8 15.8 14.7 14.8
 [463] 14.9 15.8 17.1 16.2 15.3 16.2 17.1 16.2 14.9 16.2 15.2 15.3 16.2 16.8
 [477] 16.2 16.8 13.8 15.6 16.2 14.9 16.2 15.4 16.8 15.2 16.2 16.2 17.1 15.4
 [491] 15.2 14.3 16.8 15.3 14.9 13.5 13.5 15.1 15.2 15.8 13.2 15.6 14.9 15.8
 [505] 15.8 15.1 16.2 16.8 16.8 14.9 14.3 15.3 16.2 14.2 14.1 14.9 16.2 16.8
 [519] 16.2 15.8 16.8 15.1 14.9 14.3 17.1 15.2 16.2 14.3 15.2 17.1 16.2 15.8
 [533] 14.3 14.3 15.1 16.2 15.6 17.1 14.9 16.2 14.8 14.9 15.8 14.3 14.1 13.5
 [547] 16.2 15.2 15.6 16.2 16.2 15.7 14.9 15.1 16.2 14.9 14.3 15.8 13.5 15.2
 [561] 13.8 16.2 16.2 15.8 14.9 16.2 16.2 13.5 17.1 15.0 17.1 17.1 16.8 17.1
 [575] 17.1 14.9 14.3 14.9 17.1 15.8 14.7 14.9 14.9 17.1 16.2 13.5 15.8 16.2
 [589] 14.1 16.2 14.1 16.2 16.2 15.1 17.1 14.7 15.8 16.8 15.0 15.8 15.7 15.0
 [603] 14.1 15.0 14.9 14.9 15.4 16.8 16.8 16.2 15.6 17.1 15.6 15.8 15.1 16.2
 [617] 15.6 17.1 15.3 15.1 15.8 15.8 16.2 17.1 15.8 15.4 17.1 13.5 15.4 13.5
 [631] 16.2 16.8 15.8 14.9 16.2 15.2 15.8 15.8 15.2 14.1 16.2 14.1 15.3 14.1
 [645] 13.8 16.8 14.1 16.8 14.8 16.2 14.9 15.8 14.3 15.8 15.6 17.1 15.3 15.8
 [659] 16.2 15.2 15.8 14.8 15.6 15.3 16.2 16.8 14.3 16.2 14.7 15.1 15.7 13.8
 [673] 16.2 13.2 13.5 15.8 16.2 15.6 15.2 14.9 16.2 15.1 14.9 15.7 15.8 16.2
 [687] 15.2 15.1 14.1 14.2 14.9 16.8 14.8 14.9 16.2 15.8 17.1 15.2 16.2 14.8
 [701] 15.7 14.2 14.1 15.3 14.3 16.8 17.1 14.8 14.7 13.2 16.8 14.3 15.0 15.3
 [715] 15.8 15.4 14.9 17.1 15.3 15.1 13.2 14.9 15.0 14.2 14.3 15.3 16.2 16.8
 [729] 15.6 16.2 15.7 16.2 16.2 15.7 15.8 17.1 16.2 15.8 14.9 15.8 15.7 16.2
 [743] 16.2 15.7 15.3 15.8 14.9 14.3 14.9 15.3 16.2 16.2 16.2 17.1 14.2 14.1
 [757] 14.2 14.9 15.8 15.2 17.1 14.3 15.1 15.2 15.8 16.8 15.6 16.2 16.2 15.8
 [771] 16.2 16.2 15.2 15.8 15.2 16.2 14.9 16.8 15.6 16.2 13.5 16.2 13.2 15.2
 [785] 15.6 16.8 15.0 16.8 15.8 15.3 15.1 16.2 17.1 15.8 14.7 14.3 14.3 15.7
 [799] 15.8 15.1 15.3 15.7 14.1 16.2 14.1 14.1 14.3 14.2 17.1 17.1 17.1 15.1
 [813] 17.1 14.1 14.3 15.6 14.1 16.8 15.8 14.9 16.2 15.8 15.2 17.1 16.8 16.2
 [827] 15.6 16.2 16.2 15.8 15.8 16.2 15.2 14.1 17.1 14.1 15.1 15.6 17.1 14.1
 [841] 14.9 15.2 15.1 13.2 16.2 16.2 16.2 15.4 16.2 15.6 15.8 14.9 14.9 14.9
 [855] 16.2 16.2 16.2 15.2 14.9 15.2 14.9 14.1 16.2 15.2 15.2 16.2 14.9 15.2
 [869] 14.8 17.1 15.6 15.7 15.8 16.2 16.2 16.2 15.2 15.0 14.1 15.1 15.2 16.2
 [883] 15.0 16.2 15.2 16.2 15.7 14.2 16.2 16.8 16.8 17.1 15.0 14.7 16.2 15.4
 [897] 15.8 14.9 17.1 15.7 13.8 15.3 16.8 15.3 13.2 17.1 16.2 15.4 15.2 16.2
 [911] 16.8 15.1 14.9 15.2 14.1 14.3 16.2 14.3 16.2 14.3 16.2 16.8 16.2 15.8
 [925] 15.8 15.3 14.3 15.8 15.7 14.3 16.2 15.7 14.8 15.2 15.1 15.3 16.2 14.1
 [939] 15.2 15.4 15.1 15.1 15.8 13.2 15.2 16.2 15.8 14.7 17.1 15.8 15.2 15.1
 [953] 15.3 16.8 16.2 16.2 14.1 15.7 16.2 15.0 15.8 16.8 15.2 15.6 15.2 14.9
 [967] 16.2 14.3 15.6 14.3 16.2 17.1 15.2 15.8 17.1 14.1 14.9 16.2 16.8 15.1
 [981] 16.8 13.8 16.2 16.8 16.2 15.2 14.9 15.8 15.2 14.8 14.3 15.8 16.8 17.1
 [995] 16.2 15.8 15.4 16.2 15.2 15.0
attr(,"pd.method")
[1] "TBL"

caper documentation built on May 1, 2019, 9:52 p.m.