press.validate: Validation Criterion

View source: R/Community.R

press.validateR Documentation

Validation Criterion

Description

Construct a function to test a validation criterion

Usage

press.validate(edges, perturb, monitor, epsilon = 1e-05)

Arguments

edges

an edge list

perturb

a named vector that indicates which nodes were perturbed and the relative magnitude of the perturbation.

monitor

n named vector of signs (-1,0,1) that indicates the outcome of the perturbation.

epsilon

outomes below this in absolute magnitude are treated as zero.

Details

Given the an edge list that specifies a directed graph, a set of nodes to perturb and a set of nodes to monitor, press.validate constructs a function of a single argument W to test whether the response to perturbation of the system represented by the community matrix W matches an observed outcome. The outcome is only specified up to sign (-1, 0 or +1), where outcomes smaller than epsilon are treated as zero.

Value

Returns a function that when applied to a community matrix determines whether the matrix is consistent with the given validation criterion.

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)
s <- community.sampler(edges)
s$select(0.5)
## Perturb D, B and C must decrease
f <- press.validate(edges,perturb=c(D=1),monitor=c(B=-1,C=-1))
W <- s$community()
f(W)
W <- s$community()
f(W)

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