beta.pair_zerospecies: beta.pair handle plots without species

beta.pair_zerospeciesR Documentation

beta.pair handle plots without species

Description

The function 'betapart::beta.pair()' can not handle plot without species. The turnover and nestedness components following Baselga, 2010 are set to NaN due to division by zero in the formula. This applies to both cases (1) both plots do not contain any species and (2) one of the plots does not contain any species. This cases were not expected and therefore not addressed in the betapart package. Here, the two above described exceptions are addressed according to the biological expectation behind.

Usage

beta.pair_zerospecies(x, index.family = "sorensen")

Arguments

x

a data.set with same requirements as for beta.pair. *Note* for the project BetaDivMultifun, the function 'prepare_for_betapair' can be used. For more information, please read the documentation for beta.pair.

index.family

is "sorensen" as set by default. Originally, it could be either "sorensen" or "jaccard", but no additional functionality has been implemented for the "jaccard" index.

Details

This function aims to adress the special cases in beta.pair() without changing the overall behaviour of the function.

Betadiversity can be set to 0 or 1 in the described cases :

If both plots do not contain any species, according to e.g. Carlo Ricotta https://doi.org/10.1002/ece3.2980 , this can be interpreted as the ultimate loss of betadiversity, and thus betadiversity and its components can be set to 0. e.g. Plot "P1" contains 3 species, "P2" and "P3" do not contain any species : P1 : 1 1 1 0 0 0 0 P2 : 0 0 0 0 0 0 0 P3 : 0 0 0 0 0 0 0

betadiversity(P2, P3) is set to beta.sor = 0 = beta.sne + beta.sim

If one plot contains species and the other not, the difference is pure nestedness, i.e. the maximal possible amount of nestedness, because 100 betadiversity(P1, P2) is set to beta.sne = 1, beta.sim = 0, beta.sor = 1

What is different compared to the beta.pair function? Cases of plots with zero species are catched by the output of betapart.core. The cases are set to 0 or 1, as described above.

Please note, that the Baselga 2010 pairwise framework used in betapart::beta-pair "sorensen" family is independent of richness. This can be an advantage, but has the following consequence : A plot without species (empty plot) differs from a plot with 2 species by beta = 1. It differs from a plot with 200 species with beta = 1 as well. Thus regardless of the number of species lost, beta-diversity is at it's maximum of 1. This has to be taken into account in the interpretation of the results.

note that some tests of the function are provided as example.

Value

same as for function beta.pair. A list with three dissimilarity matrices, being beta.sim, beta.sne and beta.sor. For more information, please read the documentation for beta.pair.

Examples

TESTING
prepare test dataset
test <- data.table(Species = rep(c("S1", "S2", "S3", "S4", "S5"), 4), 
                   Plot = paste("P", sort(rep(seq(1, 4), 5)), sep = ""),
                   value = c(rep(0, 5), 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, rep(0, 5)))
test <- prepare_for_betapair(test)
old_res <- betapart::beta.pair(test, index.family = "sorensen") # producin NaN s
res <- beta.pair_zerospecies(test, index.family = "sorensen")

# all tests need to be TRUE
all(!any(is.nan(res$beta.sim)), !any(is.nan(res$beta.sne)), !any(is.nan(res$beta.sor))) # there are no more NaN values in the dataset any more.
all(res$beta.sne[is.nan(old_res$beta.sne)] %in% c(0, 1)) # previously NaN are now 0 or 1
all(res$beta.sor[is.nan(old_res$beta.sne)] %in% c(0, 1)) # previously NaN are now 0 or 1
all(res$beta.sim[is.nan(old_res$beta.sne)] %in% c(0)) # previously NaN are now 0 or 1
all(res$beta.sor[is.nan(old_res$beta.sne)]== res$beta.sne[is.nan(old_res$beta.sne)]) # beta.sor. and beta.sne are the same

allanecology/BetaDivMultifun documentation built on Nov. 9, 2023, 8:47 p.m.