gradient_sim: Simulate HTS-SIP communities for 1 density gradient

Description Usage Arguments Value Examples

View source: R/HTSSIP_sim.R

Description

Simulate HTS-SIP communities for 1 density gradient

Usage

1
2
gradient_sim(locs, params, responseModel = "gaussian",
  countModel = "poisson", ...)

Arguments

locs

Buoyant densities of each gradient fraction

params

A matrix of parameters for coenocliner::coenocline(). See that function's documentation for more details.

responseModel

See coenocliner::coenocline()

countModel

See coenocliner::coenocline()

...

Other parameters passed to coenocliner::coenocline()

Value

A data.frame of OTU counts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# setting parameters
set.seed(2)
M = 10                                  # number of species (OTUs)
ming = 1.67                             # gradient minimum...
maxg = 1.78                                # ...and maximum
nfrac = 24                                 # number of gradient fractions
locs = seq(ming, maxg, length=nfrac)       # gradient fraction BD values
tol = rep(0.005, M)                       # species tolerances
h = ceiling(rlnorm(M, meanlog=11))    # max abundances
opt = rnorm(M, mean=1.7, sd=0.005)      # species optima
params = cbind(opt=opt, tol=tol, h=h)  # put in a matrix
# simulate the OTU abundances
df_OTU = gradient_sim(locs, params)
head(df_OTU)

nick-youngblut/HTSSIP documentation built on May 23, 2019, 4:46 p.m.