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). 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.
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. The current function uses a Jaccard
like approach and defines dissimilarity as the total unshared height
proportional of the total height of the combined tree. The idea is
similar as in the UniFrac distance (Lozupone and Knight 2005), but
the implementation is completely different and only works in the
presence absence framework.
The functions need a dendrogram of species traits 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).
It is possible to analyse the non-randomness of functional diversity
using oecosimu
. This provided specifying an adequate
Null model, and the results will change with this choice.