Wrapper for qgamma, qinvgamma, and qlnorm that takes the number of species and a shape parameter and gives relative abundance estimates for each species.

try_SAD(rich, x, distr)

Arguments

rich

Integer, the total number of species in the species abundance distribution.

x

Non-negative scalar, the shape parameter for a gamma distribution.

distr

Character string, one of c("lnorm", "gamma")

Examples

try_SAD(rich = 10, x = 0.2, distr = "lnorm")
#>  [1] 30606.59 27099.94 25207.53 23791.03 22587.06 21479.79 20392.77 19246.84
#>  [9] 17902.82 15851.66
try_SAD(rich = 10, x = 2, distr = "lnorm")
#>  [1] 591080.3564 175056.9763  84878.7885  47602.5178  28319.9758  17131.5540
#>  [7]  10192.0070   5715.9769   2771.4702    820.8109

try_SAD(rich = 10, x = 0.2, distr = "gamma")
#>  [1] 5.152629e+01 1.961988e+01 8.942958e+00 4.045657e+00 1.688655e+00
#>  [6] 6.081871e-01 1.718565e-01 3.187963e-02 2.477746e-03 1.019607e-05
try_SAD(rich = 10, x = 2, distr = "gamma")
#>  [1] 23.719323 16.862208 13.463173 11.094223  9.217835  7.617366  6.175218
#>  [8]  4.806394  3.416193  1.776808

if (FALSE)  try_SAD(rich = 10, x = -1, distr = "lnorm")
try_SAD(rich = 10, x = -1, distr = "gamma")
#> Error in try_SAD(rich = 10, x = -1, distr = "gamma"): shape parameter `x` must be non-negative;
#>            positive if distr = `gamma`
try_SAD(rich = 10, x = 0, distr = "gamma")
#> Error in try_SAD(rich = 10, x = 0, distr = "gamma"): x must be positive