powerlawA: Interaction matrix with Power-Law network adjacency matrix

Description Usage Arguments Value References Examples

View source: R/powerlawA.R

Description

Generate an interaction matrix A that can be decomposed as NH.Gs . Where N is the Normal Interspecific Interaction matrix, H the interaction strength heterogeneity drawn from a power-law distribution with given parameter alpha, and G the adjacency matrix of power-law out-degree digraph ecological network, and s a scaling factor. Diagonal elements of A are subsequently set to -1.

Usage

1
powerlawA(n, alpha, stdev = 1, s = 0.1)

Arguments

n

the number of species

alpha

the power-law distribution parameter. Should be > 1. Larger values will give lower interaction strength heterogeneity, whereas values closer to 1 give strong heterogeneity in interaction strengths between the species. In other words, values of alpha close to 1 will give Strongly Interacting Species (SIS).

stdev

the standard deviation parameter of the normal distribution with mean 0 from which the elements of the nominal interspecific interaction matrix N are drawn

s

scaling parameter with which the final global interaction matrix A is multiplied. Default set to NULL where s is set to 0.1*max(A) after constructing the matrix A = NH*G

Value

The global interaction matrix A with n rows and n columns.

References

Gibson TE, Bashan A, Cao HT, Weiss ST, Liu YY (2016) On the Origins and Control of Community Types in the Human Microbiome. PLOS Computational Biology 12(2): e1004688. https://doi.org/10.1371/journal.pcbi.1004688

Examples

1
2
3
4
# Low interaction heterogeneity
A_low <- powerlawA(n = 10, alpha = 3)
# Strong interaction heterogeneity
A_strong <- powerlawA(n = 10, alpha = 1.01)

gheysenemma/microsimR documentation built on Dec. 20, 2021, 10:46 a.m.