optim.alpha.stats | R Documentation |
Average alpha diversity observed with a given number of samples per method.
optim.alpha.stats(comm, tree, methods, samples, runs = 1000)
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 data.frame with the method names (1st column) and number of samples per method (2nd column). The order of methods must be the same as in comm and the sum of the samples must be the same as nrow(comm). |
samples |
A vector with the number of samples per method to test. |
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 TD, PD or FD values 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 alpha diversity value. Rescaled to 0-1 if made for several sites, where 1 is the true diversity of each site.
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)
comm <- array(c(comm1, comm2), c(4,3,2))
colnames(comm) <- c("Sp1","Sp2","Sp3")
tree <- hclust(dist(c(1:3), method="euclidean"), method="average")
tree$labels <- colnames(comm)
methods <- data.frame(method = c("Met1","Met2","Met3"), nSamples = c(1,2,1))
optim.alpha.stats(comm,, methods, c(0,0,1))
optim.alpha.stats(comm, tree, methods, c(0,1,1), runs = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.