Learn R Programming

BAT (version 2.1.1)

optim.beta.stats: Efficiency statistics for beta-sampling.

Description

Average absolute difference between sampled and real beta diversity when using a given number of samples per method.

Usage

optim.beta.stats(comm, tree, methods, samples, abund = TRUE, runs = 0)

Arguments

comm

A samples x species x sites array, with either abundance or incidence data.

tree

An hclust or phylo object (used only to optimize PD or FD sampling).

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.

Value

A single average absolute beta diversity difference value.

Details

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).

Examples

Run this code
# NOT RUN {
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")
optim.beta.stats(comm,,methods, c(1,1,1))
optim.beta.stats(comm, tree, methods = methods, samples = c(0,0,1), runs = 100)
# }

Run the code above in your browser using DataLab