modifyA: Modify the interaction matrix

View source: R/modifyA.R

modifyAR Documentation

Modify the interaction matrix

Description

The interaction matrix can be manipulated in the following ways: adjustc: Adjust the connectance to the given value schur: apply a Schur decomposition to remove positive eigenvalues that lead to explosions in simulations with Ricker or gLV negpercent: convert positive into negative interactions, such that the interaction matrix reaches the specified percentage of negative edges/arcs (diagonal is not specially treated) tweak: multiply a randomly chosen positive entry in the interaction matrix with -1. This is useful when searching for an interaction matrix that does not lead to explosions in Ricker and gLV simulations. enforceneg: multiply off-diagonal negative entries in interaction matrix with the given factor removeorphans: remove all taxa that do not interact with other taxa and thus represent orphan nodes in the network representation of the interaction matrix mergeposlinks: remove redundant taxon names by summing replicate positive arcs and keeping the sum as entries in the matrix (negative arcs are ignored) mergeneglinks: same as mergeposlinks, but only negative entries are kept mergelinks: All entries are kept. Negative entries are subtracted, positive entries are added. The modes mergeposlinks, mergeneglinks and mergelinks expect a first column with the taxon names. They will return a matrix with row and column names representing unique taxa.

Usage

modifyA(A, mode = "adjustc", strength = "binary", factor = 2,
  minstrength = 0.1, c = 0.2, perc = 50, symmetric = FALSE)

Arguments

A

the interaction matrix

mode

modification mode, values: adjustc, schur, negpercent, tweak, enforceneg, removeorphans, mergeposlinks, mergeneglinks, mergelinks

strength

interaction strength, binary (0/1) or uniform (sampled from uniform distribution from minstrength to 1)

factor

multiplication factor for enforceneg mode

minstrength

minimum interaction strength for uniform mode (maximum is 1)

c

the target connectance (only for mode adjustc)

perc

negative edge percentage (only for mode negpercent)

symmetric

only introduce symmetric negative interactions (only for mode negpercent)

Details

An entry in the interaction matrix represents an arc in a directed network. An interaction involves two entries in the interaction matrix, which represent the influence of species A on species B and vice versa. Mode negpercent: By default, the negative arc percentage is adjusted, i.e. the percentage of negative entries in the interaction matrix. If symmetric is true, both the forward and the reverse arc of an interaction will be set to a negative value (corresponding to a competition edge), else only one arc will be set to a negative value (corresponding to an edge representing parasitism, predation or amensalism).

Value

the modified interaction matrix


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