Community: Community

Description Usage Arguments Details Examples

Description

Functions for generating and altering the simulated Community. Function Init_Community initializes a simulation.

Function bdm runs one interaction of a Gillespie Algorithm of birth death and migration process in a system of generalized Lotka-Volterra system of competing species

Function abundance returns the current abundance vector for the community.

Function elapsed_time returns the current simulation time for the community.

Function trajectories returns a data frame in which each line corresponds to the species abundance distribution at a different time.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Init_Community(abundance, interaction, K = 1000, b = 1, m = 0.1, d0 = 0,
  save.int = 1)

bdm(count = 1, progress = "text")

abundance()

elapsed_time()

trajectories()

Arguments

abundance

vector of initial abundances of species in the community (set species not present to zero). For convenience, a single number is expanded as rep(1,N) (this also happens with parameters K, d0, b and m).

interaction

matrix of interaction coefficients, see interaction.

K

carrying capacities of each species

b

birth rates (constant)

m

per capita migration rate in the metacommunity. May be the given as the resulting list of the ls_migration function

d0

death rate when N=0

save.int

History saving interval (in simulated time units)

count

Number of cycles to be simulated

progress

Should a text bar be used? Currently, "text" will produce a text based bar, and NULL will produce none.

Details

Because of the way the interaction with the underlying c++ code is implemented, only one community may be simulated at a time. Calling Init_Community more than once will overwrite the previous simulation objects!

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Initializes the community (in a global object)
Init_Community(100)
# Runs 1e6 iteractions of the birth-death-migration process
bdm(1e6)
# Gets and analyzes the abundance vector
(ab <- as.numeric(abundance()))
require(sads)
f <- sads::fitlnorm(ab[ab>0])
plot(f, which=1)
# Simulation internal time elapsed
elapsed_time()
# History saves a line for each time period elapsed (starting with 0):
dim(trajectories())

piLaboratory/GillesCom documentation built on May 25, 2019, 6:04 a.m.