optim.beta.stats {BAT} | R Documentation |
Average absolute difference between sampled and real beta diversity when using a given number of samples per method.
optim.beta.stats(comm, tree, methods, samples, abund = TRUE, runs = 0)
comm |
A samples x species x sites array, with either abundance or incidence data. |
tree |
A phylo or hclust object (used only for PD or FD) or alternatively a species x traits matrix or data.frame to build a functional tree. |
methods |
A vector specifying the method of each sample (length must be equal to nrow(comm)) |
samples |
The combination of samples per method we want to test. It should be a vector with length = number of methods. |
abund |
A boolean (T/F) indicating whether abundance data should be used (TRUE) or converted to incidence (FALSE) before analysis. |
runs |
Number of random permutations to be made to the sample order. Default is 1000. |
Different combinations of samples per method allow sampling different sub-communities. This function allows knowing the average absolute difference between sampled and real beta diversity for a given combination, for one or multiple sites simultaneously. PD and FD are calculated based on a tree (hclust or phylo object, no need to be ultrametric).
A single average absolute beta diversity difference value.
comm1 <- matrix(c(1,1,0,2,4,0,0,1,2,0,0,3), nrow = 4, ncol = 3, byrow = TRUE)
comm2 <- matrix(c(2,2,0,3,1,0,0,0,5,0,0,2), nrow = 4, ncol = 3, byrow = TRUE)
comm3 <- matrix(c(2,0,0,3,1,0,0,0,5,0,0,2), nrow = 4, ncol = 3, byrow = TRUE)
comm <- array(c(comm1, comm2, comm3), c(4,3,3))
colnames(comm) <- c("sp1","sp2","sp3")
methods <- c("Met1","Met2","Met2","Met3")
tree <- hclust(dist(c(1:3), method="euclidean"), method="average")
tree$labels <- colnames(comm)
optim.beta.stats(comm,,methods, c(1,1,1))
optim.beta.stats(comm, tree, methods = methods, samples = c(0,0,1), runs = 100)