run_sims: Running a Simulation for Neutral Theory analysis

Description Usage Arguments Value

View source: R/run_sims_function.R

Description

This function combines the functions mom2 and sim_communities to run a full simulation (generate data and estimate).

Usage

1
2
run_sims(k = 1, ps = 1, r = 1, n, m, Nt0, nOTU, Nlocal, Nmeta_sd,
  Nlocal_sd, sourc = FALSE, pool_sim = FALSE, pool_est = FALSE)

Arguments

k

This parameter sets the seed (also helpful for running this function in an apply loop)

ps

this parameter adjusts the amount of variation between samples, with a range between 0 and 1. This value is the probability that a given OTU's relative abundance with be permuted in a sample. Values of 0 result in homologous taxa abundance distributions across all samples. Default in 1.

r

this parameter adjusts the amount of variation between samples. Values can range from 0 to 1. r = 0 will result in a uniformly distributed relative abundance distribution within a sample. Default is 1.

n

the number of samples

m

true migration parameter

Nt0

total number of reads in each meta community samples. Note that if the argument for Nmeta_sd != 0, then this value will be the mean number of reads across meta community samples.

nOTU

number of OTUs

Nlocal

total number of reads in each local community samples. Note that if the argument for Nlocal_sd != 0, then this value will be the mean number of reads across meta community samples.

Nmeta_sd

this parameter adjusts the amount of variation in the number of reads in meta community samples. Specifically, this value is the standard deviation used in a normal distribution with mean Nmeta from which samples sizes are generated

Nlocal_sd

this parameter adjusts the amount of variation in the number of reads in local community samples. Specifically, this value is the standard deviation used in a normal distribution with mean Nlocal from which samples sizes are generated from.

sourc

to use source data in estimation of migration parameter

pool

to pool meta/source community data during data simulation and estimation

Value

a matrix of 4 rows: row 1 = migration parameter estimate, row 2 = mean bray curtis dissimilarity for meta community, row 3 = the estimated average shannon diversity for each sample. row 4 = average shannon diversity after the multiple samples have been generated given the inputed value for ps and OTUs with no reads across any samples are removed


kathalexknuts/ntsims documentation built on May 4, 2019, 6:40 p.m.