Package 'rarestR'

Title: Rarefaction-Based Species Richness Estimator
Description: Calculate rarefaction-based alpha- and beta-diversity. Offer parametric extrapolation to estimate the total expected species in a single community and the total expected shared species between two communities. Visualize the curve-fitting for these estimators.
Authors: Peng Zhao [aut, cre] , Yi Zou [aut]
Maintainer: Peng Zhao <[email protected]>
License: MIT + file LICENSE
Version: 1.1.0
Built: 2024-11-08 06:51:30 UTC
Source: https://github.com/pzhaonet/rarestr

Help Index


Calculate the Expected Species

Description

Calculate the Expected Species

Usage

es(x, m, method = c("a", "b"), MARGIN = 1)

Arguments

x

a data vector representing number of individuals for each species

m

the sample size parameter that represents the number of individuals randomly drawn from the sample. For ESa, m can not be larger than the sample size

method

the calculation approach of Expected Species used, with two options available as "a" and "b" to calculate ESa and ESb, with the default set as "a"

MARGIN

a vector giving the subscripts which the function will be applied over, see 'apply'.

Value

a value of Expected Species

References

Zou Y, Zhao P, Axmacher JC (2023). “Estimating total species richness: Fitting rarefaction by asymptotic approximation.” Ecosphere, 14(1), e4363. doi:10.1002/ecs2.4363.

Examples

data(share, package = 'rarestR')
rowSums(share) #The sum size of each sample is 100, 150 and 200
es(share, m = 100)
es(share, method = "b", m = 100)
# When the m is larger than the total sample size, "NA" will be filled:
es(share, m = 150)

Compute dissimilarity estimates between two samples based on Expected Species Shared (ESS)-measures, using abundance data for the species contained in each samples

Description

Compute dissimilarity estimates between two samples based on Expected Species Shared (ESS)-measures, using abundance data for the species contained in each samples

Usage

ess(x, m = 1, index = "CNESSa")

Arguments

x

a community data matrix (sample x species); sample name is the row name of the matrix

m

the sample size parameter that represents the number of individuals randomly drawn from each sample, which by default is set to m=1, but can be changed according to the users' requirements. Rows with a total sample size <m will be excluded automatically from the analysis.

index

the distance measure used in the calculation, as one of the four options "CNESSa", "CNESS","NESS" and "ESS", with the default set as "CNESSa"

Value

a pair-wised matrix

References

Zou Y, Axmacher JC (2020). “The Chord-Normalized Expected Species Shared (CNESS)-distance represents a superior measure of species turnover patterns.” Methods in Ecology and Evolution, 11(2), 273-280. doi:10.1111/2041-210X.13333.

Examples

data(share, package = 'rarestR')
ess(share)
ess(share, m = 100)
ess(share, m = 100, index = "ESS")

Plot fitted curve for TES

Description

Plot fitted curve for TES

Usage

plot_tes(TES_output, ...)

Arguments

TES_output

the output from tes()

...

other arguments passed to plot()

Value

a plot


Plot fitted curve for TESS

Description

Plot fitted curve for TESS

Usage

plot_tess(TESS_output, ...)

Arguments

TESS_output

the output from tess()

...

other arguments passed to plot()

Value

a plot


Plot the "rarestr" class

Description

Plot the "rarestr" class

Usage

## S3 method for class 'rarestr'
plot(x, ...)

Arguments

x

a "rarestr" object

...

other arguments passed to plot()

Value

Plot the "rarestr" class

Examples

data(share, package = 'rarestR')
Output_tes <- tes(share[1,])
Output_tes
plot(Output_tes)

Print the "rarestr" class

Description

This function prints the contents of a rarestr object.

Usage

## S3 method for class 'rarestr'
print(x, ...)

Arguments

x

a "rarestr" object#'

...

Other arguments passed to print().

Value

Print the "rarestr" class

Examples

data(share, package = 'rarestR')
Output_tes <- tes(share[1,])
Output_tes

Dataset for rarestR.

Description

This is a dataset comprises three samples randomly drawn from three simulated communities. Every community consists of 100 species with approximately 100,000 individuals following a log-normal distribution (mean = 6.5, SD = 1). Setting the first community as control group, the second and third community shared a total of 25 and 50 species with the control. A more detailed description of the control and scenario groups can be found in Zou and Axmacher (2021). The share dataset represents a random subsample of 100, 150 and 200 individuals from three three communities, containing 58, 57 and 74 species, respectively.

Usage

share

Format

An object of class matrix (inherits from array) with 3 rows and 142 columns.

References

Zou, Y., & Axmacher, J. C. (2021). Estimating the number of species shared by incompletely sampled communities. Ecography, 44(7), 1098-1108.


Calculation of Total Expected Species base on ESa, ESb and their average value

Description

Calculation of Total Expected Species base on ESa, ESb and their average value

Usage

tes(x)

Arguments

x

a data vector representing number of individuals for each species

Details

The value returned by the tes() function in the 'rarestr' class is a list containing three parts:

par

A data frame of the summary of the estimated values and their standard deviations based on TESa, TESb, and TESab, and the model used in the estimation of TES, either 'logistic' or 'Weibull'.

TESa

A list of the modeled results with the TESa method.

TESb

A list of the modeled results with the TESb method.

Both TESa and TESb contain five parts, including a data frame of the parameters ($par), a data frame of the simulated results ($result), a maximum x value ($xmax), a vector of the predicted x value ($Predx), and a vector of the predicted y value ($Predy)

Value

a list in a self-defined class 'rarestr'. See "Details".

References

Zou Y, Zhao P, Axmacher JC (2023). “Estimating total species richness: Fitting rarefaction by asymptotic approximation.” Ecosphere, 14(1), e4363. doi:10.1002/ecs2.4363.

Examples

data(share, package = 'rarestR')
Output_tes <- tes(share[1,])
Output_tes

Calculate the Total number of Expected Shared Species between two samples.

Description

Calculate the Total number of Expected Shared Species between two samples.

Usage

tess(x)

Arguments

x

a data matrix for two samples representing two communities (plot x species)

Details

The value returned by the tess() function in the 'rarestr' class is a list containing five parts:

par

A data frame of the summary of the estimated values and their standard deviations based on TESa, TESb, and TESab, and the model used in the estimation of TES, either 'logistic' or 'Weibull'.

result

A data frame of the simulated results.

xmax

A maximum x value.

Predx

A vector of the predicted x value.

Predy

A vector of the predicted y value.

Value

a list in a self-defined class 'rarestr'. See "Details".

References

Zou Y, Axmacher JC (2021). “Estimating the number of species shared by incompletely sampled communities.” Ecography, 44(7), 1098-1108. doi:10.1111/ecog.05625.

Examples

data(share, package = 'rarestR')
Output_tess <- tess(share[1:2,])
Output_tess