rcommunity | R Documentation |
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
)
n |
the number of communities to draw. |
size |
the number of individuals to draw in each community. |
prob |
a numeric vector containing probabilities. |
abd |
a numeric vector containing abundances. |
bootstrap |
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 \insertCiteMarcon2012adivent. If "Chao2013" or "Chao2015" (by default), a more sophisticated approach is used (see as_probabilities) following \insertCiteChao2013;textualdivent or \insertCiteChao2015;textualdivent. |
species_number |
the number of species. |
distribution |
The distribution of species abundances. May be "lnorm" (log-normal), "lseries" (log-series), "geom" (geometric) or "bstick" (broken stick). |
sd_lnorm |
the simulated log-normal distribution standard deviation. This is the standard deviation on the log scale. |
prob_geom |
the proportion of resources taken by successive species of the geometric distribution. |
fisher_alpha |
Fisher's |
coverage_estimator |
an estimator of sample coverage used by coverage. |
check_arguments |
if |
spatial |
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 |
thomas_scale |
in Thomas point patterns, the standard deviation of random displacement (along each coordinate axis) of a point from its cluster center. |
thomas_mu |
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 ( |
win |
the window containing the point pattern. It is an spatstat.geom::owin object. Default is a 1x1 square. |
species_names |
a vector of characters or of factors containing the possible species names. |
weight_distribution |
the distribution of point weights.
By default, all weight are 1.
May be "uniform" for a uniform distribution between |
w_min |
the minimum weight in a uniform, exponential or Weibull distribution. |
w_max |
the maximum weight in a uniform distribution. |
w_mean |
the mean weight in an exponential distribution (i.e. the negative of the inverse of the decay rate). |
weibull_scale |
the scale parameter in a Weibull distribution. |
weibull_shape |
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
\insertCiteMarcon2012a;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") \insertCitePreston1948divent
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")
\insertCiteFisher1943divent with parameter fisher_alpha
, geometric
("geom") \insertCiteMotomura1932divent with parameter prob_geom
,
or broken stick ("bstick") \insertCiteMacArthur1957divent.
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 \insertCiteThomas1949;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 \insertCiteRennolls1985,Turner2004divent.
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.