Skip to contents

An S4 class containing params for population sizes, rates of processes, the number of iterations to run, and much more.

Parameters include population sizes, rates of processes, the number of iterations to run, and much more.

Usage

roleParams(
  individuals_local = 100,
  individuals_meta = 1000,
  species_meta = 10,
  speciation_local = 0,
  speciation_meta = 1,
  extinction_meta = 0.8,
  dispersal_prob = 0.01,
  trait_sigma = 1,
  env_sigma = 0,
  comp_sigma = 0,
  neut_delta = 1,
  env_comp_delta = 0.5,
  mutation_rate = 0,
  equilib_escape = 0,
  alpha = 1,
  num_basepairs = 0,
  init_type = "oceanic_island",
  niter = 10,
  niterTimestep = NULL
)

Arguments

individuals_local

a single numeric or an "iter function"

individuals_meta

a single integer

species_meta

a single integer

speciation_local

a single numeric or an "iter function"

speciation_meta

a single numeric

extinction_meta

a single numeric

dispersal_prob

a single numeric or an "iter function"

trait_sigma

a single numeric

env_sigma

a single numeric

comp_sigma

a single numeric

neut_delta

a single numeric

env_comp_delta

a single numeric

mutation_rate

a single numeric

equilib_escape

a single numeric

alpha

a single numeric or an "iter function"

num_basepairs

a single integer

init_type

a character vector either "oceanic_island" or "bridge_island"

niter

an integer

niterTimestep

an integer

Value

a `roleParams` object

Details

Params `init_type`, `niter`, `niterTimestep`, `mutation_rate`,`equilib_escape`,and `num_basepairs` take a single value. All other params are numeric vectors containing either one value or `niter` values. If one value is supplied, that value is used for all iterations of the model. If `niter`values are supplied, a different sequential value in the `niter` vector is used for each iteration.

`individuals_local`, `speciation_local` and `dispersal_prob` are unique in that they are allowed to time-vary over the course of the model run. If you would like these to time-vary you can supply an "iter function" that takes a model iteration number and returns the value that that param should take at that iteration in the model.

Slots

individuals_local

Number of individuals in the local community (J). Determines the length of raw individual-level trait, abundance, and genetic data vectors returned for simulations. When the model is initialized, all individuals are of a single species from the metacommunity.

individuals_meta

Number of individuals in the metacommunity. Used in generating a log series of the initial abundances of species in the metacommunity.

species_meta

Number of species in the metacommunity. Determines the initial size of the phylogeny.

speciation_local

Probability of speciation occurring in the local community at each time step. The new local species can be either from a birth in the local community or an immigration from the metacommunity - the `dispersal prob` param determines the chance of each of these scenarios.

speciation_meta

rate of speciation in meta community. This is used during the simulation of the start phylogeny before the model is run The sum of speciation_meta and extinction_meta is the average lifetime of phylo branches, and the larger this value the less new individual traits will deviate from the parent's individual trait (if parent is in the local comm) or the metacommunity mean (if parent in the metacomm)

extinction_meta

Rate of extinction in the metacommunity. Like speciation_meta, used in the initial phylogeny simulation and in relation to trait deviation.

dispersal_prob

Probability of dispersal (immigration) occurring from the metacommunity to the local local community at each time step. Every time step, either birth or immigration happens, so the probability of birth is 1 minus the dispersal_prob.

trait_sigma

Rate of Brownian trait evolution in the metacommunity. Determines how much the trait of a new individual deviates from its parent, i.e. how fast traits change.

env_sigma

Selectivity of the environmental filter, i.e. how strongly the environment selects which trait values are a good match for it. The larger the value, the less chance an individual will survive if it's far from the trait optimum (which is 0).

comp_sigma

the size of the competition kernel: how strongly distance from the traits of other species selects which trait values are likely to survive. The larger the value, the greater the chance an individual will survive if it is close in trait space to others

neut_delta

the degree of neutrality - if 1 there is no environmental filtering or competition, if 0 there is full competition and filtering.

env_comp_delta

a slider between environmental filtering and competition - if 1 there is full filtering and no competition, if 0 there is full competition and no filtering.

mutation_rate

Rate of sequence mutation to use in genetic simulations.

equilib_escape

Proportion of equilibrium required to halt the model as it is running and return it

alpha

alpha parameter

num_basepairs

Number of basepairs to use in genetic simulations. Genetic simulations are currently single-locus.

init_type

The biological model used to initialize; a single character string that can be either "oceanic_island", "bridge_island", or "bare_island." The bridge island model has the initial individuals in the local community arriving through a land bridge, while the oceanic has no bridge and is populated by a single dispersal event. Thus, for oceanic island models, all individuals are of a SINGLE species sampled proportional to meta community species abundances, while in bridge island models, individuals are sampled of MANY species proportional to their abundances. The bare island model is related to the oceanic island model, but instead of starting with "individuals_local" individuals of the sole sampled species, only 1 individual of that species appears and the rest of the space is filled with placeholder "rocks" representing unfilled space.

niter

An integer specifying the number of time steps for the model to run.

niterTimestep

An integer specifying the frequency (in numbers of iterations) at which the model state is snapshot and saved in a model's model steps object.

Examples

# Create a set of params
params <- roleParams(individuals_local = 100, individuals_meta = 1000,
species_meta = 10, speciation_local = 0.5, 
speciation_meta = 1, extinction_meta = 0.8, env_sigma = 0.5,
trait_sigma=1,comp_sigma = 0.1, dispersal_prob = 0.1, mutation_rate = 0.01,
equilib_escape = 1, num_basepairs = 250,
init_type = 'oceanic_island', niter = 2, niterTimestep = 2)

# Use it to create a roleModel
model <- roleModel(params)
# create a default set of params but change the number of individuals in the local
p <- roleParams(individuals_local=500)
# create a new set of params but randomly deviating the speciation rate using an "iter function"
spfun <- function(i){rnorm(1,mean=0.1,sd=0.01)}
p <- roleParams(speciation_local=spfun)