Functional Diversity and Community Distances from Species Trees
treedive.Rd
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.
Usage
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 intree
. IfFALSE
, matching only happens when dimensions differ (with a warning or message). The order of data must match to the order intree
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 function as.hclust.phylo
in the
ape package.
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 the package picante, but
excludes tree root if that is not needed to connect species. Function
treedist
is similar to the phylogenetic similarity
phylosor
in the package picante, but excludes
unneeded tree root and returns distances instead of similarities.
taxondive
is something very similar from another bubble.
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.29620 760.23 385.20 644.67 1233.9 0.03 *
#> 2 568.88 -2.22692 1215.84 649.02 1339.24 1564.5 0.01 **
#> 3 1172.95 -0.43907 1284.55 677.24 1370.46 1575.4 0.43
#> 4 1327.93 -0.42048 1431.34 864.04 1504.33 1721.4 0.37
#> 5 1426.91 -0.14022 1460.83 911.09 1525.18 1819.6 0.57
#> 6 1391.16 0.28736 1321.63 740.99 1401.76 1606.6 0.93
#> 7 1479.51 0.18540 1437.20 853.04 1492.68 1758.2 0.87
#> 8 1523.08 0.70990 1344.59 717.82 1438.56 1632.7 0.37
#> 9 1460.04 0.16816 1419.50 809.66 1477.72 1729.5 0.79
#> 10 1316.48 -0.12971 1351.18 767.98 1424.35 1677.9 0.61
#> 11 1367.00 0.70777 1149.03 625.41 1276.27 1591.2 0.65
#> 12 1423.56 0.96075 1160.43 621.61 1280.56 1468.5 0.17
#> 13 895.11 -1.19410 1220.90 686.93 1321.30 1576.4 0.41
#> 14 1457.27 1.55141 968.38 472.49 1135.54 1383.9 0.01 **
#> 15 1505.95 1.42618 1113.70 551.82 1238.63 1456.4 0.03 *
#> 16 1187.52 0.43897 1060.57 597.67 1170.12 1469.8 0.97
#> 17 517.69 -1.38742 958.23 469.83 1103.43 1369.2 0.19
#> 18 1394.52 0.82126 1151.38 624.42 1271.22 1490.8 0.41
#> 19 1470.47 1.12946 1143.17 665.28 1269.64 1525.6 0.15
#> 20 1439.56 1.18012 1066.60 558.50 1214.36 1475.2 0.17
#> ---
#> 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 distance-based RDA
dbrda(dtree ~ 1)
#> Call: dbrda(formula = dtree ~ 1)
#>
#> -- Model Summary --
#>
#> Inertia Rank RealDims
#> Total 2.183
#> Unconstrained 2.183 19 10
#>
#> Inertia is squared Treedist distance
#>
#> -- Eigenvalues --
#>
#> Eigenvalues for unconstrained axes:
#> MDS1 MDS2 MDS3 MDS4 MDS5 MDS6 MDS7 MDS8
#> 1.1971 0.4546 0.2967 0.1346 0.1067 0.0912 0.0391 0.0190
#> (Showing 8 of 19 unconstrained eigenvalues)
#>