rcommunity() draws random communities according to a probability distribution.
rspcommunity() extends it by spatializing the random communities.
rcommunity(
n,
size = sum(abd),
prob = NULL,
abd = NULL,
bootstrap = c("Chao2015", "Marcon2012", "Chao2013"),
species_number = 300,
distribution = c("lnorm", "lseries", "geom", "bstick"),
sd_lnorm = 1,
prob_geom = 0.1,
fisher_alpha = 40,
coverage_estimator = c("ZhangHuang", "Chao", "Turing", "Good"),
check_arguments = TRUE
)rspcommunity(
n,
size = sum(abd),
prob = NULL,
abd = NULL,
bootstrap = c("Chao2015", "Marcon2012", "Chao2013"),
species_number = 300,
distribution = c("lnorm", "lseries", "geom", "bstick"),
sd_lnorm = 1,
prob_geom = 0.1,
fisher_alpha = 40,
coverage_estimator = c("ZhangHuang", "Chao", "Turing", "Good"),
spatial = c("Binomial", "Thomas"),
thomas_scale = 0.2,
thomas_mu = 10,
win = spatstat.geom::owin(),
species_names = NULL,
weight_distribution = c("Uniform", "Weibull", "Exponential"),
w_min = 1,
w_max = 1,
w_mean = 15,
weibull_scale = 20,
weibull_shape = 2,
check_arguments = TRUE
)
rcommunity() returns an object of class abundances.
rspcommunity() returns either a spatialized community,
which is a dbmss::wmppp object , with PointType
values as species names if n=1 or an object of class ppplist
(see spatstat.geom::solist) if n>1.
the number of communities to draw.
the number of individuals to draw in each community.
a numeric vector containing probabilities.
a numeric vector containing abundances.
the method used to obtain the probabilities to generate bootstrapped communities from observed abundances. If "Marcon2012", the probabilities are simply the abundances divided by the total number of individuals Marcon2012adivent. If "Chao2013" or "Chao2015" (by default), a more sophisticated approach is used (see as_probabilities) following Chao2013;textualdivent or Chao2015;textualdivent.
the number of species.
The distribution of species abundances. May be "lnorm" (log-normal), "lseries" (log-series), "geom" (geometric) or "bstick" (broken stick).
the simulated log-normal distribution standard deviation. This is the standard deviation on the log scale.
the proportion of resources taken by successive species of the geometric distribution.
Fisher's \(\alpha\) in the log-series distribution.
an estimator of sample coverage used by coverage.
if TRUE, the function arguments are verified.
Should be set to FALSE to save time when the arguments have been checked elsewhere.
the spatial distribution of points.
May be "Binomial" (a completely random point pattern except for its fixed number of points) or
"Thomas" for a clustered point pattern with parameters scale and mu.
in Thomas point patterns, the standard deviation of random displacement (along each coordinate axis) of a point from its cluster center.
in Thomas point patterns, the mean number of points per cluster.
The intensity of the Poisson process of cluster centers is calculated as
the number of points (size) per area divided by thomas_mu.
the window containing the point pattern. It is an spatstat.geom::owin object. Default is a 1x1 square.
a vector of characters or of factors containing the possible species names.
the distribution of point weights.
By default, all weight are 1.
May be "uniform" for a uniform distribution between w_min and w_max,
"weibull" with parameters w_min, weibull_scale and shape or
"exponential" with parameter w_mean.
the minimum weight in a uniform, exponential or Weibull distribution.
the maximum weight in a uniform distribution.
the mean weight in an exponential distribution (i.e. the negative of the inverse of the decay rate).
the scale parameter in a Weibull distribution.
the shape parameter in a Weibull distribution.
Communities of fixed size are drawn in a multinomial distribution according
to the distribution of probabilities provided by prob.
An abundance vector abd may be used instead of probabilities,
then size is by default the total number of individuals in the vector.
Random communities can be built by drawing in a multinomial law following
Marcon2012a;textualdivent, or trying to estimate the
distribution of the actual community with probabilities.
If bootstrap is "Chao2013", the distribution is estimated by a single
parameter model and unobserved species are given equal probabilities.
If bootstrap is "Chao2015", a two-parameter model is used and unobserved
species follow a geometric distribution.
Alternatively, the probabilities may be drawn following a classical
distribution: either lognormal ("lnorm") Preston1948divent
with given standard deviation (sd_lnorm; note that the mean is actually
a normalizing constant. Its value is set equal to 0 for the simulation of
the normal distribution of unnormalized log-abundances), log-series ("lseries")
Fisher1943divent with parameter fisher_alpha, geometric
("geom") Motomura1932divent with parameter prob_geom,
or broken stick ("bstick") MacArthur1957divent.
The number of simulated species is fixed by species_number, except for
"lseries" where it is obtained from fisher_alpha and size:
\(S = \alpha \ln(1 + size / \alpha)\).
Note that the probabilities are drawn once only.
If the number of communities to draw, n, is greater than 1, then they are
drawn in a multinomial distribution following these probabilities.
Log-normal, log-series and broken-stick distributions are stochastic. The geometric distribution is completely determined by its parameters.
Spatialized communities include the location of individuals in a window, in a dbmss::wmppp object. Several point processes are available, namely binomial (points are uniformly distributed in the window) and Thomas1949;textualdivent, which is clustered.
Point weights, that may be for instance the size of the trees in a forest community, can be uniform, follow a Weibull or a negative exponential distribution. The latter describe well the diameter distribution of trees in a forest Rennolls1985,Turner2004divent.
# Generate a community made of 100000 individuals among 300 species and fit it
abundances <- rcommunity(n = 1, size = 1E5,
species_number = 300, distribution = "lnorm")
autoplot(abundances)
X <- rspcommunity(1, size = 30, species_number = 5)
autoplot(X)
Run the code above in your browser using DataLab