ricker: Generate time series with the Ricker model

View source: R/ricker.R

rickerR Documentation

Generate time series with the Ricker model

Description

The Ricker model is a discrete version of the generalized Lotka-Volterra model and is implemented here as proposed by Fisher and Mehta in PLoS ONE 2014.

Usage

ricker(N, A, K = rep(0.1, N), y = runif(N), sigma = 0.05,
  K.trend = NA, tend = 100, death.t = NA, tskip = 0,
  explosion.bound = 10^8, perturb = NULL)

Arguments

N

number of species

A

interaction matrix

K

a vector of carrying capacities

y

initial abundances

sigma

noise level, if set to a non-positive value, no noise is added

K.trend

a vector of positive or negative carrying capacity percentages specified between 0 and 1

tend

number of time points

death.t

species with abundance below this value are killed (abundance is set to 0)

tskip

number of initial time points to skip (to skip the transient)

explosion.bound

boundary for explosion

perturb

a perturbation object

Details

If an explosion occurs, -1 is returned. An explosion is reported if any species crosses the explosion bound. To avoid explosions, decrease the number of interactions in the interaction matrix and/or increase the number of negative interactions in the interaction matrix. K.trend contains carrying capacity percentages (from the original carrying capacity) that are added to each species' current carrying capacity in each time step. K.trend allows to simulate an environmental trend. Negative carrying capacities are set to zero. If both a perturbation and K.trend are specified, the perturbation is carried out first.

Value

a matrix with species abundances as rows and time points as columns

References

Fisher & Mehta (2014). Identifying Keystone Species in the Human Gut Microbiome from Metagenomic Timeseries using Sparse Linear Regression. PLoS One 9:e102451

See Also

glv for the generalized Lotka Volterra model

Examples

tsplot(ricker(10,generateA(10),K=rep(0.01,10)),main="ricker")
per=perturbation(times=seq(10,100,10),durations=rep(1,10),numberchanges=c(0.1,rep(0,9)))
tsplot(ricker(10,generateA(10),K=rep(0.01,10),perturb=per))

hallucigenia-sparsa/seqtime documentation built on Jan. 9, 2023, 11:53 p.m.