metasim | R Documentation |
metasim() initiates a metacommunity simulation based on a landscape created by the make.landscape() function.
metasim(landscape, ...)
landscape |
Landscape object created by function make.landscape() |
scenario.ID |
A name for the simulation scenario. All simulations with the same scenario name will have metadata collated in a single .csv file. Default is NA |
sim.ID |
A name for this particular simulation. Default will provide a random ID. |
alpha.fisher |
User can use Fisher's alpha to seed a simulation's initial regional source pool. |
nu |
Probability a novel species will appear in a single recruitment event |
speciation.limit |
Set's a limit on the number of novel taxa that can appear in a simulation |
JM.limit |
set's an upper limit for the number of individuals in a simulation |
n.timestep |
Number of generations in a simulation |
W.r |
Dispersal kernel slope |
save.sim |
Binary, will save the simulation as a .rda file if TRUE. Default is FALSE. |
output.dir.path |
Name of directory to save simulation results and metadata. Default is "SIM_OUTPUT". Simulation will create a sub-directory in the working directory if none exists. |
trait.dispersal |
Vector of dispersal traits. Default is NULL |
trait.dispersal.median |
Scalar value for dispersal applied to all species if no vector is provided. Default is 1. |
trait.dispersal.range |
Range of dispersal values given to species if dispersal traits are randomly assigned. |
trait.Ef |
Vector of species' niche positions |
trait.Ef.sd |
Vector of species' niche breadths |
gamma.abund |
Vector of regional abundances, can be used to seed a simulation |
J.t0 |
Site by species data.table or matrix that can be used to seed a simulation |
taxa.list |
A character vector of names for species |
There are two steps to creating a metacommunity simulation in MCSim: 1. Make a "landscape" – The landscape is the “game board” on which the simulation plays out, and it is created using the make.landscape function. 2. Run the simulation – Once the landscape is created, you can pass the landscape object to metaSIM along with parameter settings that define the rules for how metacommunity dynamics will play out in the metacommunity simulation. Note that the current version of MCSim is zero sum, which means there will always be JM individuals in the simulation during each generation. For a tutorial, see http://rpubs.com/sokole/159425
Note that a user can choose to save simulation output to a directory set by output.dir.path by setting save.sim = TRUE
## Not run: set.seed(1234) #set random seed # make a landscape my.landscape <- make.landscape( site.coords = data.frame( x = c(1, 2, 3, 4, 5), y = c(1, 3, 1, 5, 2)), Ef = c(-.8, -.6, 0, .25, .9), m = 0.5, JM = 10000) # niche positions, niche breadths, and relative abundances for three species niche.positions <- c(-.5, 0, .5) niche.breadths <- c(.2, .2, 5) regional.rel.abund <- c(.8, .1, .1) # run a simulation with 10 generations sim.result <- metasim( landscape = my.landscape, trait.Ef = niche.positions, trait.Ef.sd = niche.breadths, gamma.abund = regional.rel.abund, W.r = 0, nu = 0.001, n.timestep = 10, sim.ID = "my_test_sim", output.dir.path = "my_sim_output_directory" ) # plot coenoclines to view niches plot.coenoclines(sim.result) # plot dispersal kernal plot.standardized.disp.kernel(sim.result) # plot dot plots plot.dot.plots(sim.result) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.