global: Compute global threshold backbone

View source: R/global.R

globalR Documentation

Compute global threshold backbone

Description

global extracts the backbone of a weighted network using a global threshold

Usage

global(
  G,
  upper = 0,
  lower = NULL,
  keepzeros = TRUE,
  class = "original",
  narrative = FALSE
)

Arguments

G

A weighted unipartite graph, as: (1) an adjacency matrix in the form of a matrix or sparse Matrix, or dataframe; (2) an edgelist in the form of a three-column dataframe; (3) an igraph object.

upper

real, FUN, or NULL: upper threshold value or function that evaluates to an upper threshold value.

lower

real, FUN, or NULL: lower threshold value or function that evaluates to a lower threshold value.

keepzeros

boolean: TRUE if zero-weight edges in W should be excluded from (i.e. also be zero in) the backbone

class

string: the class of the returned backbone graph, one of c("original", "matrix", "Matrix", "igraph", "edgelist"). If "original", the backbone graph returned is of the same class as W.

narrative

boolean: TRUE if suggested text & citations should be displayed.

Details

The global function retains a edge with weight W if W > upper. If a lower threshold is also specified, it returns a signed backbone in which an edge's weight is set to 1 if W > upper, is set to -1 if W < lower, and is set to 0 otherwise. The default is an unsigned backbone containing all edges with non-zero weights.

If G is an unweighted bipartite graph, the global threshold is applied to its weighted bipartite projection.

Value

Binary or signed backbone graph of class given in parameter class.

References

package: Neal, Z. P. (2022). backbone: An R Package to Extract Network Backbones. PLOS ONE, 17, e0269137. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1371/journal.pone.0269137")}

model: Neal, Z. P. (2014). The backbone of bipartite projections: Inferring relationships from co-authorship, co-sponsorship, co-attendance, and other co-behaviors. Social Networks, 39, 84-97. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.socnet.2014.06.001")}

Examples

G <- matrix(sample(0:5, 100, replace = TRUE), 10) #Random weighted graph
diag(G) <- 0
G
global(G, narrative = TRUE)  #Keep all non-zero edges
global(G, upper = 4, lower = 2, narrative = TRUE)  #Signed with specified thresholds
global(G, upper = function(x)mean(x),  #Above-average --> positive edges
          lower = function(x)mean(x), narrative = TRUE)  #Below-average --> negative edges

backbone documentation built on May 29, 2024, 8:03 a.m.