define_tolerance: Define tolerance values for ABC model in mcfly

View source: R/define_tolerance.R

define_toleranceR Documentation

Define tolerance values for ABC model in mcfly

Description

Define tolerance values for ABC model in mcfly

Usage

define_tolerance(
  comm,
  phylo,
  envir,
  xy.coords,
  occurrence,
  entropy.order,
  niche.breadth = 10,
  m = 0.5,
  n.timestep = 50,
  OU.alpha = c("uniform", "half-life"),
  max.sample.size.prior = 100 * parallel,
  sample.size.posterior = 20 * parallel,
  parallel = NULL,
  scenario.ID = "doc",
  output.dir.path = "einstein",
  probs = c(0.8, 0.9, 0.95, 0.99)
)

Arguments

comm

Matrix containing occurrences or abundances of species in sites. Species in columns and sites in rows.

phylo

Newick object containing the phylogenetic relationship among species.

envir

A one column matrix containing environmental variable for each community

xy.coords

A two column matrix containing the coordinates of each community

occurrence

Logical argument (TRUE or FALSE) indicating if community matrix must be transformed to presence/absence

entropy.order

Numeric value indicating the scale of Rényi diversity, as accepted by renyi. Default is 1

niche.breadth

Numeric value indicating the width of niche of species in the metacommunity, as accepted by metasim. Default is 10

m

Numeric value indicating the immigration rate at each site, reported as Hubbel´s m. This is the same parameter accepted by metasim.

n.timestep

Numeric value indicating the number of timesteps used in the simulation of metacommunities, this is the same argument used in metasim. Default is 50, it is not recommended the use of lower values.

OU.alpha

Character indicating the type of prior that will be used in ABC model. The options were "uniform" for a uniform sample of alpha values and "half-life" for a prior of alpha values represented as being half-life values, calculated as being log().

max.sample.size.prior

Numeric indicating the maximum number of sampling in prior distribution. Default is 100 times the number of parallel process.

sample.size.posterior

Numeric value that defines the minimum size of the posterior distribution. Default is 240.

parallel

Numerical value indicating the numbers of cores that must be used in the parallel computation. Default is NULL, indicating that the calculations of ABC model will not be parallelized.

scenario.ID

Character indicating the name of the simulation scenario. The same as used in metasim. Default is "doc".

output.dir.path

Character indicating the name of directory to save simulations results and metadata used in metasim. Default is "einstein".

probs

Numeric indicating the quantiles to be used in tolerance distribution values. Default is c(0.8,0.9,0.95,0.99)

Value

A list containing the following objects:

Posterior

A numerical vector with posterior distribution

Tolerance

A numerical vector with tolerance values


GabrielNakamura/mcfly documentation built on July 27, 2023, 12:45 p.m.