| simulateGLV {miaSim} | R Documentation |
Simulates time series with the generalized Lotka-Volterra model and forms a SummarizedExperiment object.
simulateGLV( n.species, A, x = runif(n.species), b = runif(n.species), t.end = 1000, norm = FALSE, ... )
n.species |
Integer: number of species |
A |
interaction matrix |
x |
Numeric: initial abundances |
b |
Numeric: growth rates |
t.end |
Numeric: simulation end time (default: |
norm |
Logical scalar: returns normalised abundances (proportions
in each generation) (default: |
... |
additional arguments that can be called from miaSim::tDyn |
Simulates a community time series using the generalized Lotka-Volterra model, defined as dx/dt = x(b+Ax), where x is the vector of species abundances, diag(x) is a diagonal matrix with the diagonal values set to x. A is the interaction matrix and b is the vector of growth rates.
The resulting abundance matrix model is used to construct SummarizedExperiment object.
simulateGLV returns a SummarizedExperiment object
containing abundance matrix
row_data <- data.frame(Kingdom = "Animalia",
Phylum = rep(c("Chordata", "Echinodermata"), c(500, 500)),
Class = rep(c("Mammalia", "Asteroidea"), each = 500),
ASV = paste0("X", seq_len(1000)),
row.names = rownames(paste0("species", seq_len(1000))),
stringsAsFactors = FALSE)
row_data <- t(row_data)
col_data <- DataFrame(sampleID = seq_len(1001),
time = as.Date(1000, origin = "2000-01-01"),
row.names = colnames(paste0("sample", seq_len(1001))))
A <- miaSim::powerlawA(4, alpha = 1.01)
SEobject <- simulateGLV(n.species = 4, A, t.end = 1000)
rowData(SEobject) <- row_data
colData(SEobject) <- col_data