Tree Phylogenetic Diversity

Creating a continuous metric of diversity for tree diversity plots. Each plot has either 1 or 4 species from a pool of 6 species. Using phylogenetic diversity measures, tree diversity can be a continuous variable that indicates the total richness of trees within the plot (PD) and/or (2) how similar/dissimilar the tree species are (MPD).

PD: Phylogenetic richness; the sum of all branch lengths
MPD: Mean pairwise distance; how taxa are distributed
SES.MPD: Standardized effect size of mean pairwise distance; MPD value standardized by expected MPD under null model

Tree species: Ceiba pentandra, Cordia dodecandra, Enterolobium cyclocarpum, Piscidia piscipula, Swietenia macrophylla, Tabebuia rosea

Building the phylogenetic tree

Using S.PhyloMaker function and plant phylogenetic tree provided by Qian and Jin 2016

source("https://raw.githubusercontent.com/jinyizju/S.PhyloMaker/master/R_codes%20for%20S.PhyloMaker")##S.PhyloMaker function to prune tree?
plant.tree<-read.tree("trees/QianJin_2016.txt")##read in PhytoPhylo newick
##species of interest
sps<-c("Ceiba pentandra", "Cordia dodecandra", "Enterolobium cyclocarpum", "Piscidia piscipula", "Swietenia macrophylla", "Tabebuia rosea")
taxaids<-data.frame(species = sps,
                    genus= c("Ceiba","Cordia","Enterlobium","Piscidia","Swietenia","Tabebuia"),
                    family=c("malvaceae","boraginaceae","fabaceae","fabaceae","meliaceae","bignoniaceae"))## 2 species are in the same family

plant.tree.df<-read.csv("trees/PhytoPhylo.csv")##read in PhytoPhylo dataframe from Qian & Jin 2016
tree.phy<-S.PhyloMaker(taxaids, plant.tree, nodes=plant.tree.df, output.splist = T)
## [1] "Note: 1 taxa unmatched."

Tree Phylogeny

Computes 3 scenarios- Scanerio 3 includes species that do not have species level resolution by inferring by genus

par(mfrow=c(1,3),mar=c(0,0,1,0)) # show the phylogenies of the three scenarios.
plot(tree.phy$Scenario.1,cex=1.1,main="Scenarion One")
plot(tree.phy$Scenario.2,cex=1.1,main="Scenarion Two")
plot(tree.phy$Scenario.3,cex=1.1,main="Scenarion Three")##incldues all species

trees.phy<-tree.phy$Scenario.3

Calculating PD for tree diversity plots

bird.div<-read.csv("data/bird.div.vars.csv")
tree.data<-read.csv("data/plot_meta.csv")

sp_s<-gsub(" ", "_", sps)
colnames(tree.data)<-c("DIV","GDIV","PLOT","treecomp","plot_id",sp_s[5],sp_s[1],sp_s[2],sp_s[4],sp_s[6],sp_s[3])##replace letters with Tree species names for matching
tree.mat<-tree.data[,6:11]##matrix of tree species presence/plot composition
tree.mat[is.na(tree.mat)]<-0##replace NA wth 0
##sum of all branches (PD richness)
tree.pd<-pd(tree.mat, trees.phy)
##distance-based measures
trees.dist<-cophenetic.phylo(trees.phy)##distance matrix
##Mean pairwise distande (MPD) and SES mpd
tree.mpd<-ses.mpd(tree.mat,trees.dist,null.model = "sample.pool", abundance.weighted = FALSE,runs = 999)##problematic for monoculture plots
tree.ord<-reorder(bt$treecomp,bt$PD)
ggplot(bt,aes(x=tree.ord,y=PD,fill=PD))+geom_bar(stat="identity")+theme_mooney()+theme(axis.text.x=element_text(angle=90))

Does Tree PD correlate with bird PD?

ggplot(bird.div.pd,aes(x=treePD,y=PD))+
  geom_point(size=3,shape=1)+
  geom_smooth(method="lm",se=F)+
  theme_mooney()+
  scale_x_continuous(limits=c(0,500))+
  scale_y_continuous(limits=c(0,500))

pander(summary(aov(lm(PD~treePD,data=bird.div.pd))))
Analysis of Variance Model
  Df Sum Sq Mean Sq F value Pr(>F)
treePD 1 177536 177536 22.28 0.00005122
Residuals 30 239004 7967 NA NA

Does Tree PD correlate with bird species richness & abundance?

srp<-ggplot(bird.div.pd,aes(x=treePD,y=SR))+
  geom_point(size=3,shape=1)+
  geom_smooth(method="lm",se=F)+
  theme_mooney()+
  scale_x_continuous(limits=c(0,500))+
  labs(x="Tree PD",y="Bird Species Richness")

abunp<-ggplot(bird.div.pd,aes(x=treePD,y=abun_l))+
  geom_point(size=3,shape=1)+
  geom_smooth(method="lm",se=F)+
  theme_mooney()+
  scale_x_continuous(limits=c(0,500))+
  labs(x="Tree PD",y="Bird Abundance")

plot_grid(srp,abunp,nrow=1,ncol=2)

Species Richness

pander(summary(aov(lm(SR~treePD,data=bird.div.pd))))
Analysis of Variance Model
  Df Sum Sq Mean Sq F value Pr(>F)
treePD 1 67.13 67.13 9.953 0.003638
Residuals 30 202.3 6.745 NA NA

Abundance

pander(summary(aov(lm(abun_l~treePD,data=bird.div.pd))))
Analysis of Variance Model
  Df Sum Sq Mean Sq F value Pr(>F)
treePD 1 3.685 3.685 7.275 0.01136
Residuals 30 15.2 0.5065 NA NA

Caterpillar Predation?

ggplot(allt,aes(x=treePD,y=bird_rate_div))+
  geom_point(size=3,shape=1)+
  geom_smooth(method="lm",se=F)+
  theme_mooney()+
  scale_x_continuous(limits=c(0,500))+
  labs(x="Tree PD",y="Caterpillar Predation")

Caterpillar Predation Rates

pander(summary(aov(lm(bird_rate_div~treePD,data=allt))))
Analysis of Variance Model
  Df Sum Sq Mean Sq F value Pr(>F)
treePD 1 0.04546 0.04546 9.443 0.00577
Residuals 21 0.1011 0.004813 NA NA