sim_thomas_community: Simulate community with clumped spatial positions.

View source: R/Sim_Community.R

sim_thomas_communityR Documentation

Simulate community with clumped spatial positions.

Description

This function simulates a community with a certain abundance distribution and with intraspecific aggregation, i.e. individuals of the same species are distributed in clusters.

Usage

sim_thomas_community(
  s_pool,
  n_sim,
  sad_type = "lnorm",
  sad_coef = list(cv_abund = 1),
  fix_s_sim = FALSE,
  sigma = 0.02,
  cluster_points = NA,
  mother_points = NA,
  xmother = NA,
  ymother = NA,
  xrange = c(0, 1),
  yrange = c(0, 1),
  seed = NULL
)

Arguments

s_pool

Number of species in the pool (integer)

n_sim

Number of individuals in the simulated community (integer)

sad_type

Root name of the species abundance distribution model of the species pool (character) - e.g., "lnorm" for the lognormal distribution (rlnorm); "geom" for the geometric distribution (rgeom), or "ls" for Fisher's log-series distribution (rls).

See the table in Details below, or rsad for all SAD model options.

sad_coef

List with named arguments to be passed to the distribution function defined by the argument sad_type. An overview of parameter names is given in the table below.

In mobsim the log-normal and the Poisson log-normal distributions can alternatively be parameterized by the coefficient of variation (cv) of the relative abundances in the species pool. Accordingly, cv_abund is the standard deviation of abundances divided by the mean abundance (no. of individuals / no. of species). cv_abund is thus negatively correlated with the evenness of the species abundance distribution.

Please note that the parameters mu and sigma are not equal to the mean and standard deviation of the log-normal distribution.

fix_s_sim

Should the simulation constrain the number of species in the simulated local community? (logical)

sigma

Mean displacement (along each coordinate axes) of a point from its mother point (= cluster centre). Sigma correlates with cluster extent. When length(sigma) == length(abund_vec), each species receives a specific cluster extent. Otherwise, the first value of sigma is recycled and all species share the same cluster extent. When sigma of any species is more than twice as large as the largest plot dimension, a random Poisson distribution is simulated, which is more efficient than a Thomas cluster process. The parameter sigma corresponds to the scale parameter of the function rThomas in the package spatstat.random.

cluster_points

Mean number of points per cluster. If this is a single value, species have the same average number of points per cluster. If this is a vector of the same length as abund_vec, each species has a specific mean number of points per cluster. If no value is provided, the number of points per cluster is determined from the abundance and from mother_points. If mother_points and cluster_points are given OR xmother and ymother, and cluster points are given, cluster_points is overridden. If mother_points=0, there will be no clustering even if cluster_points=400 (high clustering) because cluster_points is overridden. The parameter cluster_points corresponds to the mu parameter of spatstat.random::rThomas.

mother_points

Number of mother points (= cluster centres). If this is a single value, all species have the same number of clusters. For example mother_points = 1 can be used to simulate only one cluster per species, which then represents the complete species range. If mother_points is a vector of the same length as abund_vec, each species has a specific number of clusters. If mother_points equals 0 there is no clustering and the distribution is homogeneous. If no value is provided, the number of clusters is determined from the abundance and the number of points per cluster (cluster_points).

xmother

List of length equal to the number of species. Each list element is a vector of x coordinates for every mother points. If one element is NA, the the corresponding species is not clustered.

ymother

List of length equal to the number of species. Each list element is a vector of y coordinates for every mother points. If one element is NA, the the corresponding species is not clustered.

xrange

Extent of the community in x-direction. If this a numeric vector of length 2, all species share the same range. To specify different x ranges for all species, xrange should be a data.frame with 2 columns, min and max.

yrange

Extent of the community in y-direction. If this a numeric vector of length 2, all species share the same range. To specify different y ranges for all species, xrange should be a data.frame with 2 columns, min and max.

seed

Integer. Any integer passed to set.seed for reproducibility.

Details

This function consecutively calls sim_sad and sim_thomas_coords

See the documentations of sim_sad and sim_thomas_coords for details.

Value

A community object as defined by community

Author(s)

Felix May

Examples

com1 <- sim_thomas_community(s_pool = 20, n_sim = 500, sad_type = "lnorm",
                             sad_coef = list("meanlog" = 2, "sdlog" = 1),
                             sigma = 0.01)
plot(com1)


mobsim documentation built on May 29, 2024, 8:15 a.m.