randomA | R Documentation |
Generates a random interaction matrix for Generalized Lotka-Volterra (GLV) model.
randomA(
n_species,
names_species = NULL,
diagonal = -0.5,
connectance = 0.2,
scale_off_diagonal = 0.1,
mutualism = 1,
commensalism = 1,
parasitism = 1,
amensalism = 1,
competition = 1,
interactions = NULL,
symmetric = FALSE,
list_A = NULL
)
n_species |
Integer: number of species |
names_species |
Character: names of species. If NULL,
|
diagonal |
Values defining the strength of self-interactions. Input can
be a number (will be applied to all species) or a vector of length n_species.
Positive self-interaction values lead to exponential growth.
(default: |
connectance |
Numeric frequency of inter-species interactions.
i.e. proportion of non-zero off-diagonal terms.
Should be in the interval 0 <= connectance <= 1.
(default: |
scale_off_diagonal |
Numeric: scale of the off-diagonal elements
compared to the diagonal.
(default: |
mutualism |
Numeric: relative proportion of interactions terms
consistent with mutualism (positive <-> positive)
(default: |
commensalism |
Numeric: relative proportion of interactions terms
consistent with commensalism (positive <-> neutral)
(default: |
parasitism |
Numeric: relative proportion of interactions terms
consistent with parasitism (positive <-> negative)
(default: |
amensalism |
Numeric: relative proportion of interactions terms
consistent with amensalism (neutral <-> negative)
(default: |
competition |
Numeric: relative proportion of interactions terms
consistent with competition (negative <-> negative)
(default: |
interactions |
Numeric: values of the n_species^2 pairwise interaction
strengths. Diagonal terms will be replaced by the 'diagonal' parameter
If NULL, interactions are drawn from
|
symmetric |
Logical: whether the strength of mutualistic and competitive
interactions are symmetric. This is implemented by overwrite a half of the
matrix, so the proportions of interactions might deviate from expectations.
(default: |
list_A |
List: a list of matrices generated by randomA. Used to support
different groups of interactions. If NULL (by default), no group is
considered. Otherwise the given list of matrices will overwrite values around
the diagonal.
(default: |
randomA
returns a matrix A with dimensions (n_species x n_species)
dense_A <- randomA(
n_species = 10,
scale_off_diagonal = 1,
diagonal = -1.0,
connectance = 0.9
)
sparse_A <- randomA(
n_species = 10,
diagonal = -1.0,
connectance = 0.09
)
user_interactions <- rbeta(n = 10^2, .5, .5)
user_A <- randomA(n_species = 10, interactions = user_interactions)
competitive_A <- randomA(
n_species = 10,
mutualism = 0,
commensalism = 0,
parasitism = 0,
amensalism = 0,
competition = 1,
connectance = 1,
scale_off_diagonal = 1
)
parasitism_A <- randomA(
n_species = 10,
mutualism = 0,
commensalism = 0,
parasitism = 1,
amensalism = 0,
competition = 0,
connectance = 1,
scale_off_diagonal = 1,
symmetric = TRUE
)
list_A <- list(dense_A, sparse_A, competitive_A, parasitism_A)
groupA <- randomA(n_species = 40, list_A = list_A)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.