mcfly: Title Estimating the influence of stabilizing selection on...

Description Usage Arguments Details

View source: R/mcfly_function.R

Description

mcfly function to estimate the influence of stabilizing niche selection on species diversity across environmental gradients

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mcfly(
  comm,
  phylo,
  envir,
  xy.coords,
  occurrence = TRUE,
  entropy.order = 1,
  niche.breadth = 10,
  m = 0.5,
  n.timestep = 50,
  OU.alpha = c("uniform", "half-life"),
  W.r.prior = FALSE,
  summary.stat = "correlation",
  tol = 0.2,
  sample.size.posterior = 240,
  max.sample.size.prior = 2400,
  HPD = 0.9,
  return.comm = FALSE,
  return.w.priors = FALSE,
  return.alpha.priors = TRUE,
  parallel = NULL,
  scenario.ID = "mcfly",
  output.dir.path = "delorean"
)

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().

W.r.prior

Logical (TRUE or FALSE) indicating if the the W.r parameter would be a single value (FALSE) with value of 0, indicating a panmictic metacommunity or follow a prior distribution (TRUE) of values calculated as being the slopes of dispersal kernel indicating the contribution of species from neighboring patches to the local immigrant pool.

summary.stat

Character indicating the type of summary statistic that will be used in ABC model. Default is "correlation", that is calculated as the correlation between the diversity values calculated according to the Rényi scale defined in entropy.order argument. Another option is "dimensionality" but it is not implemented yet.

tol

Numeric value that defines the tolerance value (calculated as 1 - correlation) used in ABC model to assemble the posterior distribution. Default is 0.2.

sample.size.posterior

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

max.sample.size.prior

Numeric value that defines the maximum size of the posterior distribution. Default is 2400.

HPD

Numeric value indicating the probability mass for the Highest Density Interval for the posterior probability distribution obtained in ACB model. This is the same value used in hdi. Default is 0.9.

return.comm

Logical (TRUE/FALSE), indicating if the simulated metacommunities must be returned in the output. Default is FALSE.

return.w.priors

Logical (TRUE/FALSE), indicating if the prior distribution of W.r values used in ABC model must be returned in the output. Default is FALSE

return.alpha.priors

Logical (TRUE/FALSE), indicating if the the prior distribution of alpha values must be returned in the output. Default is FALSE.

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 "mcfly".

output.dir.path

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

Details

This function estimate the influence of stabilizing niche selection on species diversity across environmental gradients by applying to a occurrence matrix of species containing presence/absence or abundance an Approximate Bayesian Computation (ABC) framework. We used in ABC a individual based-model from MCSim package


GabrielNakamura/mcfly documentation built on June 10, 2021, 8:44 p.m.