# Load Paracou data (number of trees per species in two 1-ha plot of a tropical forest)
data(Paracou618)
# Ps is the vector of probabilities
Ps <- Paracou618.MC$Ps
# Calculate Shannon entropy
Shannon(Ps)
# Ns is the vector of abundances of the metacommunity
Ns <- Paracou618.MC$Ns
# Calculate an unbiased estimator of Shannon entropy
bcShannon(Ns)
# Use metacommunity data to calculate unbiased Shannon beta as mutual information
(bcShannon(Paracou618.MC$Ns) + bcShannon(colSums(Paracou618.MC$Nsi))
- bcShannon(Paracou618.MC$Nsi))
# Compare with Chao and Shen correction (works for Tsallis entropy in general)
summary(BetaEntropy(Paracou618.MC, 1))
Run the code above in your browser using DataLab