treedive(comm, tree, match.force = TRUE, verbose = TRUE)
treeheight(tree)
treedist(x, tree, relative = TRUE, match.force = TRUE, ...)
treedive
must be for species
(columns).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.dist
and
can be used similarly.
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 $2AB - A - B$, where
$A$ and $B$ are heights of component trees and
$AB$ is the height of the combined tree. With relative = TRUE
the dissimilarity is $(2AB - A - B)/(AB)$.
Although the latter formula is similar to
Jaccard dissimilarity (see vegdist
,
designdist
), it is not in the range $0
\dots 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.
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.
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.
## 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)
## 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)
## Phylogenetically ordered community table
dtree <- treedist(dune, cl)
tabasco(dune, hclust(dtree), cl)
## Use tree distances in capscale
capscale(dtree ~ 1, comm=dune)
Run the code above in your browser using DataLab