Learn R Programming

backbone (version 1.4.0)

universal: Compute universal threshold backbone

Description

`universal` returns a backbone graph in which edge weights are set to 1 if above the given upper parameter threshold, set to -1 if below the given lower parameter threshold, and are 0 otherwise.

Usage

universal(M, upper = NULL, lower = NULL, bipartite = NULL, narrative = FALSE)

Arguments

M

graph: Graph object of class matrix, sparse matrix, igraph, edgelist, or network object. Any rows and columns of the associated bipartite matrix that contain only zeros are automatically removed before computations.

upper

Real, FUN, or NULL: upper threshold value or function to be applied to the edge weights. Default is NULL.

lower

Real, FUN, or NULL: lower threshold value or function to be applied to the edge weights. Default is NULL.

bipartite

Boolean: TRUE if bipartite graph, FALSE if weighted graph. Default is NULL. If TRUE, input graph should be unweighted.

narrative

Boolean: TRUE if suggested text for a manuscript is to be returned

Value

backbone, a list(backbone, summary). The `backbone` object is a graph object of the same class as M. The `summary` contains a data frame summary of the inputted matrix and the model used including: model name, number of rows, skew of row sums, number of columns, skew of column sums, and running time.

Details

If both `upper` and `lower` are `NULL`, a weighted projection is returned.

If `bipartite` is `NULL`, the function tries to guess at whether the data is bipartite or unipartite based on its shape.

Examples

Run this code
# NOT RUN {
test <- universal(davis%*%t(davis), upper = function(x)mean(x)+sd(x), lower=function(x)mean(x))
test2 <- universal(davis, upper = function(x)mean(x)+2*sd(x), lower = 2, bipartite = TRUE)
test3 <- universal(davis, upper = 4, lower = 2, bipartite = TRUE)
# }

Run the code above in your browser using DataLab