Learn R Programming

backbone (version 2.1.0)

global: Compute global threshold backbone

Description

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

Usage

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

Value

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

Arguments

W

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 in the backbone if its weight exceeds upper. If a lower threshold is also specified, it returns a signed backbone in which edge weights are set to 1 if above the given upper threshold, set to -1 if below the given lower threshold, and set to 0 otherwise. Prior to v2.0.0, the global function was called universal(), which is now depricated.

If W is an unweighted bipartite graph, any rows and columns that contain only zeros or only ones are removed, then the global threshold is applied to its weighted bipartite projection.

References

package: Neal, Z. P. (2022). backbone: An R Package to Extract Network Backbones. PLOS ONE, 17, e0269137. 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. tools:::Rd_expr_doi("10.1016/j.socnet.2014.06.001")

Examples

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

Run the code above in your browser using DataLab