I've written functions in R that use the same matrix notation as in Petchey & Gaston (2002)
Instructions
- Gain an understanding of how to use R.
- Use the dist() and hclust() functions to calculate a dendrogram from a trait matrix.
- Paste this function (Xtree) into R. Use it to transform the object returned by hclust() into an object from which total branch is easy to calculate.
- The object returned by Xtree() is a list containing a species by branch matrix (H1) and a branch length vector (h2) (see Petchey & Gaston (2002)
for more information on these). - Follow the methods in Petchey & Gaston (2002)
to get FD from H1 and h2.
Here's an example of using R to calculate the FD of a random community as it loses species; just paste the text into R. (Remember to paste in Xtree()!)
And here's an example of how to calculate the FD of communities that have different composition, and to see if FD correlates with an arbitrary measure of functioning)