Calculate the Expected Species

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

zou2023rarestR

Examples

data(share, package = 'rarestR')
rowSums(share) #The sum size of each sample is 100, 150 and 200
#>   1   2   3 
#> 100 150 200 
es(share, m = 100)
#>        1        2        3 
#> 58.00000 47.77653 53.00568 
es(share, method = "b", m = 100)
#>        1        2        3 
#> 43.51041 40.74378 46.19118 
# When the m is larger than the total sample size, "NA" will be filled:
es(share, m = 150)
#> Warning: m can not be larger than the total sample size
#>        1        2        3 
#>       NA 57.00000 65.24147