Skip to contents

Simulate metacommunity dynamics

Usage

mcsim(
  n_species = 5,
  n_patch = 5,
  n_warmup = 200,
  n_burnin = 200,
  n_timestep = 1000,
  propagule_interval = NULL,
  propagule_seed = 0.5,
  carrying_capacity = 100,
  xi = 1,
  interaction_type = "constant",
  alpha = 0,
  min_alpha = NULL,
  max_alpha = NULL,
  r0 = 4,
  niche_optim = NULL,
  min_optim = -1,
  max_optim = 1,
  sd_niche_width = NULL,
  min_niche_width = 0.1,
  max_niche_width = 1,
  niche_cost = 1,
  xy_coord = NULL,
  distance_matrix = NULL,
  dispersal_matrix = NULL,
  p_disturb = 0,
  i_disturb = 0,
  landscape_size = 10,
  mean_env = 0,
  sd_env = 0.1,
  spatial_env_cor = FALSE,
  phi = 1,
  p_dispersal = 0.1,
  theta = 1,
  zeta = 0,
  impact = 0,
  plot = FALSE
)

Arguments

n_species

Integer. Number of species in a metacommunity.

n_patch

Integer. Number of patches in a metacommunity.

n_warmup

Integer. Number of time-steps for warm-up. Default 200.

n_burnin

Integer. Number of time-steps for burn-in. Default 200.

n_timestep

Integer. Number of time-steps to be saved. Default 1000.

propagule_interval

Integer. Time interval for propagule introduction during warm-up. If NULL, a value of ceiling(n_warmup / 10) will be used.

propagule_seed

Numeric. Propagule mean density (intensity parameter in a Poisson distribution). Default 0.5.

carrying_capacity

Numeric. Carrying capacities of individual patches. Length must be one or equal to n_patch. Default 100.

xi

Numeric. Hassell exponent. Undercompensation (xi < 1), no compensation (xi = 1; reduced to Beverton-Holt), and overcompensation (xi > 1).

interaction_type

Character. "constant" or "random". "constant" assumes the unique interaction strength of alpha for all pairs of species. "random" draws random numbers from a uniform distribution with min_alpha and max_alpha.

alpha

Numeric matrix. Species interaction strength. Enabled if interaction_type = "constant". Default 0.

min_alpha

Numeric. Minimum value of a uniform distribution generating interaction strength. Enabled if interaction_type = "random". Default NULL.

max_alpha

Numeric. Maximum value of a uniform distribution generating interaction strength. Enabled if interaction_type = "random". Default NULL.

r0

Numeric. Maximum reproductive number of the Beverton-Holt model. Length must be one or equal to n_species.

niche_optim

Numeric. Niche optimum of species (the environmental value at which the reproductive number is maximized). Length must be one or equal to n_species. Default NULL.

min_optim

Numeric. Minimum value of a uniform distribution generating the optimal environmental values of simulated species. Values are randomly assigned to species. Enabled if niche_optim = NULL.

max_optim

Numeric. Maximum value of a uniform distribution generating the optimal environmental values of simulated species. Values are randomly assigned to species. Enabled if niche_optim = NULL.

sd_niche_width

Numeric. Niche width of species. Higher values indicate greater niche width. Length must be one or equal to n_species.

min_niche_width

Numeric. Minimum value of a uniform distribution generating the niche width values of simulated species. Values are randomly assigned to species. Enabled if sd_niche_width = NULL.

max_niche_width

Numeric. Maximum value of a uniform distribution generating the niche width values of simulated species. Values are randomly assigned to species. Enabled if sd_niche_width = NULL.

niche_cost

Numeric. This parameter determines the cost of wide niche. Smaller values imply greater costs of wider niche. Default 1.

xy_coord

Site coordinates. Must be provided as a data frame, in which each row corresponds to an individual site with x and y coordinates (columns). Defualt NULL.

distance_matrix

Distance matrix. Each element must indicate distance between a given pair of habitat patches. If provided, the distance matrix will be used to generate dispersal matrix and distance decay of environmental correlations. Default NULL.

dispersal_matrix

Dispersal matrix. If provided, this matrix overrides distance_matrix to simulate dispersal process. Default NULL.

p_disturb

Numeric. Disturbance probability.

i_disturb

Numeric. Disturbance intensity expressed as proportional mortality (0 to 1). Length must be one or equal to n_patch.

landscape_size

Length of a landscape on a side. Enabled if distance_matrix = NULL and dispersal_matrix = NULL.

mean_env

Numeric. Mean environmental values of patches. Length must be one or equal to n_patch.

sd_env

Numeric. Standard deviation of temporal environmental variation at each patch.

spatial_env_cor

Numeric. If TRUE, spatial autocorrelation in temporal environmental fluctuation is considered. Default FALSE.

phi

Numeric. This parameter describes the distance decay of spatial autocorrelation in temporal environmental fluctuation. Enabled if spatial_env_cor = TRUE.

p_dispersal

Numeric. This parameter describes dispersal probability. Length must be one or equal to n_species.

theta

Numeric. Rate parameter of exponential dispersal kernel.

zeta

Numeric. Species sensitivity to environmental pollutants.

impact

Numeric. Concentration of environmental pollutants.

plot

Logical. If TRUE, five sample patches and species of df_dynamics are plotted.

Reference

see package webpage for details

Author

Akira Terui, hanabi0111@gmail.com

Examples

if (FALSE) { # \dontrun{
# not run
mcsim(n_patch = 5, n_species = 5)
} # }