system.simulate: Simulate System

View source: R/Community.R

system.simulateR Documentation

Simulate System

Description

Simulate Inverse Community Matrices for a Network

Usage

system.simulate(
  n.sims,
  edges,
  required.groups = c(0),
  sampler = community.sampler(edges, required.groups),
  validators = NULL
)

Arguments

n.sims

number of matrices to simulate.

edges

an edge list.

required.groups

a vector of integers specifying which groups of edges must always occur in the community matrix.

sampler

the sampler object used to generate random weights (see community.sampler)

validators

an (optional) list of validation functions generated by press.validate.

Details

Generate sets of edge weights and the inverse community matrices given a directed graph and validation criteria by rejection sampling. Matrices with a pattern of signs consistent with the given model are generated, and only the matrices that correspond to stable equilibria and consistent with the given validation criteria are retained. For matrices retained in the sample, the matrix is inverted, and the inverse community matrix, and the weights that define the community matrix are returned. The function also returns the total number of matrices generated, the number of these that are stable and the number that are ultimately accepted for the sample.

The output of this function may be passed to the interactive exploratory tools.

This function is a simple wrapper for community.sampler, stable.community and the functions generated by press.validate.

Value

Returns a list with elements

edges

The edge list

A

A list of inverse community matrices

w

A matrix of the corresponding edge weights

total

The total number of matrices generated

stable

The number of stable matrices generated

accepted

The number of matrices accepted for the sample

Examples

set.seed(32)
## Sample model
edges <- parse.digraph(c(
  "E *-> D",
  "D *-> C",
  "C -> E",
  "E *-> B",
  "B *-> A",
  "A -> E",
  "D --> B"))
edges <- enforce.limitation(edges)
sims <- system.simulate(10,edges,
                        validators=list(
                          press.validate(edges,
                                         perturb=c(D=1),
                                         monitor=c(D=1)),
                          press.validate(edges,
                                         perturb=c(D=1),
                                         monitor=c(B=-1,C=1))))

SWotherspoon/QPress documentation built on Sept. 26, 2022, 2:27 a.m.