press.impact {QPress}R Documentation

Response to Press Perturbation

Description

Construct a function to calculate response to perturbation.

Usage

press.impact(edges, perturb, monitor = NULL)

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 that indicates the subset of nodes to monitor.

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.impact constructs a function of a single argument W that determines the response of the monitored nodes to the perturbation for a simulated community matrix W.

Value

Returns a function that when applied to a community matrix calculates the response to a press perturbation.

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, monitor C
f <- press.impact(edges,perturb=c(D=1),monitor=c(C=0))
W <- s$community()
f(W)
W <- s$community()
f(W)
## Perturb D, monitor all
f <- press.impact(edges,perturb=c(D=1))
W <- s$community()
f(W)
W <- s$community()
f(W)

[Package QPress version 0.21 Index]