# Load Paracou data (number of trees per species in two 1-ha plot of a tropical forest)
data(Paracou618)
# Prepare the similarity matrix
DistanceMatrix <- as.matrix(EightSpTree$Wdist^2/2)
# Similarity can be 1 minus normalized distances between species
Z <- 1 - DistanceMatrix/max(DistanceMatrix)
# Calculate diversity of order 2
Ps <- EightSpAbundance/sum(EightSpAbundance)
Dqz(Ps, 2, Z)
# Equal to phylodiversity when q=2
summary(PhyloDiversity(Ps, 2, EightSpTree))
# But different for all other q, e.g. 1
Dqz(Ps, 1, Z)
summary(PhyloDiversity(Ps, 1, EightSpTree))
Run the code above in your browser using DataLab