Lab Knowledge-base: R scripts
*R scripts provided here are available to all with no strings attached. However, these come with no guarantees that the scripts do what you think they are doing, or that they won’t adversely affect your computer or stress levels. Feel free to e-mail me with any questions on using them.
Thanks
Marc
Phylogenetic diversity
addPart - calculates Lande's (1996) additive partitioning of diversity for richness, simpson and shannon indices.
PDcalc - Calculates phylogenetic diversity for a file with multiple communities (thanks to Jonathan Davies).
randMinPD - Randomization for significance testing for the smallest phyloegentic distance in a community.
simp.phy - Calculates Simpson's index weighted by phylogenetic distance among species according to Hardy & Senterre (2007) for each community in a community x species matrix plus a 'phylo' object.
phyloBeta - Calculates additively partitioned phylogenetic diversity (alpha, beta, gamma) according Lande's (1996) scheme. It includes weighting for local (alpha) mean PD based on number of species. Also if the number of randomizations (n.rand) is greater than 0, it also produces confidence test.
MultiPD - Calculate PD from phylogeny with multiple trees (e.g., 100 most probable trees from Baysian analysis) with a set of communities.
PD & FD script - From a phylogeny, community file and trait matrix, this script calculates PD, several multivariate functional diversity metrics (e.g., Walker et al. 1999, Petchey & Gaston 2002) and single trait variation and produces a single file with these mulitple diversity measures for each community.
Phylogenetic signal tests
Krand - Randomization for significance testing for Blomberg's K.
K script - Loops Krand through a file with multiple communities -becareful that n.rand is set to 1000 and with a bunch of communities it can take a long time.
pic.func - Function to calculate the sum of absolute phylogentically independent contrasts values and compare them to null values. This is an alternative to the K statistic for detecting phylo-signal. May be less sensitive to small sample sizes???
Other phylogeny manipulations
DistPlot - plot Mantel tests, where two observations or species from a phylogeny color code the dot in a scatterplot. Allows you to see if one species is biasing Mantel tests.
subTree - Create subtree from larger phylogeny using a vector of species names.

