Functional diversity is defined as the total branch length in a trait dendrogram connecting all species, but excluding the unnecessary root segments of the tree (Petchey and Gaston 2006). Tree distance is the increase in total branch length when combining two sites.

treedive(comm, tree, match.force = TRUE, verbose = TRUE)
treeheight(tree)
treedist(x, tree, relative = TRUE, match.force = TRUE, ...)

Arguments

comm, x

Community data frame or matrix.

tree

A dendrogram which for treedive must be for species (columns).

match.force

Force matching of column names in data (comm, x) and labels in tree. If FALSE, matching only happens when dimensions differ (with a warning or message). The order of data must match to the order in tree if matching by names is not done.

verbose

Print diagnostic messages and warnings.

relative

Use distances relative to the height of combined tree.

...

Other arguments passed to functions (ignored).

Details

Function treeheight finds the sum of lengths of connecting segments in a dendrogram produced by hclust, or other dendrogram that can be coerced to a correct type using as.hclust. When applied to a clustering of species traits, this is a measure of functional diversity (Petchey and Gaston 2002, 2006), and when applied to phylogenetic trees this is phylogenetic diversity.

Function treedive finds the treeheight for each site (row) of a community matrix. The function uses a subset of dendrogram for those species that occur in each site, and excludes the tree root if that is not needed to connect the species (Petchey and Gaston 2006). The subset of the dendrogram is found by first calculating cophenetic distances from the input dendrogram, then reconstructing the dendrogram for the subset of the cophenetic distance matrix for species occurring in each site. Diversity is 0 for one species, and NA for empty communities.

Function treedist finds the dissimilarities among trees. Pairwise dissimilarity of two trees is found by combining species in a common tree and seeing how much of the tree height is shared and how much is unique. With relative = FALSE the dissimilarity is defined as \(2 (A \cup B) - A - B\), where \(A\) and \(B\) are heights of component trees and \(A \cup B\) is the height of the combined tree. With relative = TRUE the dissimilarity is \((2(A \cup B)-A-B)/(A \cup B)\). Although the latter formula is similar to Jaccard dissimilarity (see vegdist, designdist), it is not in the range \(0 \ldots 1\), since combined tree can add a new root. When two zero-height trees are combined into a tree of above zero height, the relative index attains its maximum value \(2\). The dissimilarity is zero from a combined zero-height tree.

The functions need a dendrogram of species traits or phylogenies as an input. If species traits contain factor or ordered factor variables, it is recommended to use Gower distances for mixed data (function daisy in package cluster), and usually the recommended clustering method is UPGMA (method = "average" in function hclust) (Podani and Schmera 2006). Phylogenetic trees can be changed into dendrograms using as.hclust.phylo (package ape)

It is possible to analyse the non-randomness of tree diversity using oecosimu. This needs specifying an adequate Null model, and the results will change with this choice.

Value

A vector of diversity values or a single tree height, or a dissimilarity structure that inherits from dist and can be used similarly.

References

Lozupone, C. and Knight, R. 2005. UniFrac: a new phylogenetic method for comparing microbial communities. Applied and Environmental Microbiology 71, 8228--8235.

Petchey, O.L. and Gaston, K.J. 2002. Functional diversity (FD), species richness and community composition. Ecology Letters 5, 402--411.

Petchey, O.L. and Gaston, K.J. 2006. Functional diversity: back to basics and looking forward. Ecology Letters 9, 741--758.

Podani J. and Schmera, D. 2006. On dendrogram-based methods of functional diversity. Oikos 115, 179--185.

See also

Function treedive is similar to the phylogenetic diversity function pd in picante, but excludes tree root if that is not needed to connect species. Function treedist is similar to the phylogenetic similarity phylosor in picante, but excludes unneeded tree root and returns distances instead of similarities.

taxondive is something very similar from another world.

Examples

## There is no data set on species properties yet, and we demonstrate ## the methods using phylogenetic trees data(dune) data(dune.phylodis) cl <- hclust(dune.phylodis) treedive(dune, cl)
#> forced matching of 'tree' labels and 'comm' names
#> 1 2 3 4 5 6 7 8 #> 384.0913 568.8791 1172.9455 1327.9317 1426.9067 1391.1628 1479.5062 1523.0792 #> 9 10 11 12 13 14 15 16 #> 1460.0423 1316.4832 1366.9960 1423.5582 895.1120 1457.2705 1505.9501 1187.5165 #> 17 18 19 20 #> 517.6920 1394.5162 1470.4671 1439.5571
## Significance test using Null model communities. ## The current choice fixes numbers of species and picks species ## proportionally to their overall frequency oecosimu(dune, treedive, "r1", tree = cl, verbose = FALSE)
#> Warning: nullmodel transformed 'comm' to binary data
#> oecosimu object #> #> Call: oecosimu(comm = dune, nestfun = treedive, method = "r1", tree = #> cl, verbose = FALSE) #> #> nullmodel method ‘r1’ with 99 simulations #> #> alternative hypothesis: statistic is less or greater than simulated values #> #> statistic SES mean 2.5% 50% 97.5% Pr(sim.) #> 1 384.09 -1.229338 741.96 379.57 626.88 1230.9 0.11 #> 2 568.88 -2.267401 1203.99 666.90 1341.41 1498.1 0.03 * #> 3 1172.95 -0.072303 1194.23 629.80 1310.34 1565.5 0.67 #> 4 1327.93 -0.555377 1439.49 853.87 1488.59 1712.8 0.31 #> 5 1426.91 -0.303558 1496.51 897.67 1539.49 1790.3 0.35 #> 6 1391.16 0.286511 1315.03 738.80 1408.39 1627.0 0.87 #> 7 1479.51 0.298154 1398.40 828.85 1483.13 1752.4 0.97 #> 8 1523.08 0.667870 1340.33 757.62 1425.92 1679.2 0.53 #> 9 1460.04 0.236619 1396.51 808.08 1483.84 1721.0 0.89 #> 10 1316.48 -0.242465 1378.15 748.22 1450.11 1716.8 0.45 #> 11 1367.00 0.800840 1125.61 628.25 1255.35 1521.6 0.47 #> 12 1423.56 0.911062 1144.59 605.62 1253.41 1563.0 0.33 #> 13 895.11 -1.329553 1235.46 635.50 1327.80 1551.5 0.33 #> 14 1457.27 1.530148 971.79 504.63 1099.37 1402.3 0.01 ** #> 15 1505.95 1.451136 1074.02 551.58 1180.28 1461.3 0.01 ** #> 16 1187.52 0.487626 1037.99 574.47 1152.11 1465.2 0.89 #> 17 517.69 -1.353440 935.50 454.66 835.76 1376.5 0.11 #> 18 1394.52 0.765699 1148.36 591.45 1296.93 1532.6 0.43 #> 19 1470.47 1.177282 1121.21 634.84 1248.00 1515.2 0.19 #> 20 1439.56 1.260642 1049.11 523.88 1219.30 1448.7 0.09 . #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
## Phylogenetically ordered community table dtree <- treedist(dune, cl) tabasco(dune, hclust(dtree), cl)
## Use tree distances in capscale capscale(dtree ~ 1, comm=dune)
#> Call: capscale(formula = dtree ~ 1, comm = dune) #> #> Inertia Rank #> Total 2.1834 #> Unconstrained 2.3439 10 #> Imaginary -0.1605 9 #> Inertia is squared Treedist distance #> Species scores projected from ‘dune’ #> #> Eigenvalues for unconstrained axes: #> MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8 MDS9 MDS10 #> 1.1971 0.4546 0.2967 0.1346 0.1067 0.0912 0.0391 0.0190 0.0045 0.0004 #>