simulate_MC: Simulate Metacommunity Dynamics

View source: R/MC_simulate.R

simulate_MCR Documentation

Simulate Metacommunity Dynamics

Description

Simulate Metacommunity Dynamics

Usage

simulate_MC(
  patches,
  species,
  dispersal = 0.01,
  plot = TRUE,
  torus = FALSE,
  kernel_exp = 0.1,
  env1Scale = 500,
  timesteps = 1200,
  burn_in = 800,
  initialization = 200,
  max_r = 5,
  min_env = 0,
  max_env = 1,
  env_niche_breadth = 0.5,
  optima_spacing = "random",
  intra = 1,
  min_inter = 0,
  max_inter = 1,
  comp_scaler = 0.05,
  extirp_prob = 0,
  landscape,
  disp_mat,
  env.df,
  env_optima,
  int_mat
)

Arguments

patches

number of patches to simulate

species

number of species to simulate

dispersal

dispersal probability between 0 and 1

plot

option to show plot of landscape

torus

whether to model the landscape as a torus

kernel_exp

the exponential rate at which dispersal decreases as a function of the distance between patches

env1Scale

scale of temporal environmental autocorrelation between -2 (anticorrelated) and 2 (correlated), default is 2

timesteps

number of timesteps to simulate

burn_in

length of burn in period

initialization

length of initial period before environmental change begins

max_r

intrinsic growth rate in optimal environment, can be single value or vector of length species

min_env

minium environmental optima

max_env

minium environmental optima

env_niche_breadth

standard deviation of environmental niche breadth, can be single value or vector of length species

optima_spacing

"even" or "random" to specify how optima should be distributed

intra

intraspecific competition coefficient, single value or vector of length species

min_inter

min interspecific comp. coefficient

max_inter

max interspecific comp. coefficient

comp_scaler

value to multiply all competition coefficients by

extirp_prob

probability of local extirpation for each population in each time step (should be a very small value, e.g. 0 or 0.002)

landscape

optional dataframe with x and y columns for patch coordinates

disp_mat

optional matrix with each column specifying the probability that an individual disperses to each other patch (row)

env.df

optional dataframe with environmental conditions with columns: env1, patch, time

env_optima

optional values of environmental optima, should be a vector of length species

int_mat

optional externally generated competition matrix

Value

list that includes metacommunity dynamics, landscape coordinates, environmental conditions, species environmental traits, dispersal matrix, and the competition matrix

Author(s)

Patrick L. Thompson, patrick.thompson@zoology.ubc.ca

Examples

simulate_MC(patches = 6, species = 10, dispersal = 0.001, min_inter = 1, max_inter = 1, env_niche_breadth = 10)


plthompson/mcomsimr documentation built on Feb. 6, 2023, 8:20 a.m.