View source: R/ABC_functions.R
abc_moran_deme | R Documentation |
This function runs multiple simulations of the Moran Community model by randomly generating parameters according to user input prior distributions for use in downstream ABC analyses.
abc_moran_deme(
nsims,
t,
priors,
x.max = NULL,
y.max = NULL,
spatial = NULL,
eqpop = FALSE,
eqmig = TRUE,
outgens = NULL
)
nsims |
Numeric, The number of simulations to run. |
t |
Numeric, the number of generations to run for each simulation. |
priors |
Priors object specifying the priors to use for simulations. See |
x.max , y.max |
Numeric, maximum spatial extent in x or y direction for site placement if randomly generating spatial data. |
spatial |
Two column Numeric matrix or Distance object specifying spatial arrangement of communities. |
eqpop |
Logical, if TRUE all community sizes are the same within a simulation, if FALSE each community is randomly given a community size each simulation. |
eqmig |
Logical, if TRUE all species will have the same migration matrix, if FALSE each species will recieve it's own migration matrix each simulation according to priors file settings |
outgens |
Integer, vector giving the generations for which metacommunities should be output |
This function is used to run the Moran Community model simulation multiple times in preparation for Approximate Bayesian Analysis (ABC). Users specify prior distributions for community size, selection coefficients, frequency dependence, and migration parameters in a priors object. From this information, parameter values are randomly drawn according to the prior distributions and simulations are run from these parameter values.
If all communities have the same size, then returns a list with a list of final metacommunity matrices for each simulation, a list of selection matrices used for each simulation, a matrix with frequency dependence parameters for each species (columns are species and rows are simulation runs), and a dataframe with the parameters used for each simulation (each row corresponds to one simulation). If communities are allowed to have different sizes, then the list also contains a matrix containing the community sizes for each community in each simulation.
testpriors <- make_priors(5, 5)
xy <- random_points(5, 100, 100)
testpriors$jdist <- 1
testpriors$jparams <- c(100, 200)
testpriors$seldist <- 2
testpriors$selparams <- c(.5, .1)
testpriors$fddist <- 1
testpriors$fdparams <- c(-.5, -.2)
testpriors$migdist <- 1
testpriors$migdistparams <- c(10, 50)
testpriors$migprobdist <- 1
testpriors$migprobparams <- c(.1, .2)
abc_moran_deme(5, 5, testpriors, eqpop = FALSE, spatial = xy)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.