generateA: Generate an interaction matrix

View source: R/generateA.R

generateAR Documentation

Generate an interaction matrix

Description

Generate an interaction matrix, either randomly from a uniform distribution or using Klemm-Eguiluz algorithm to generate a modular and scale-free interaction matrix.

Usage

generateA(N = 100, type = "random", pep = 50, d = -0.5,
  min.strength = -0.5, max.strength = 0.5, c = 0.02,
  ignore.c = FALSE, negedge.symm = FALSE, clique.size = 5,
  groups = c(), intra.group.strength = 0.5,
  inter.group.strength = NA)

Arguments

N

number of species

type

random (sample a uniform distribution), klemm (generate a Klemm-Eguiluz matrix) or empty (zero everywhere, except for diagonal which is set to d)

pep

desired positive edge percentage (only for klemm)

d

diagonal values (should be negative)

min.strength

random: minimal off-diagonal interaction strength (only for random)

max.strength

random: maximal off-diagonal interaction strength, klemm: maximal absolute off-diagonal interaction strength

c

desired connectance (interaction probability)

ignore.c

do not adjust connectance

negedge.symm

set symmetric negative interactions (only for klemm)

clique.size

modularity parameter (only for klemm)

groups

vector of group memberships for each species, assign NA if species does not belong to any group (only for random)

intra.group.strength

interaction strength between members of the same group

inter.group.strength

interaction strength between members of different groups (if not defined, will be assigned randomly)

Value

the interaction matrix

References

Klemm & Eguiluz, Growing Scale-Free Networks with Small World Behavior http://arxiv.org/pdf/cond-mat/0107607v1.pdf

Examples

klemm=generateA(N=10,type="klemm",c=0.5)
groups=c(rep(NA,5),rep(1,10),rep(2,5),rep(3,10),rep(4,10))
Agroup=generateA(N=40,groups=groups,c=0.5,intra.group.strength=0.1,inter.group.strength=-0.5, d=-1)

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