GGMnetworkStats: Gaussian graphical model network statistics

View source: R/rags2ridges.R

GGMnetworkStatsR Documentation

Gaussian graphical model network statistics

Description

Function that calculates various network statistics from a sparse precision matrix. The sparse precision matrix is taken to represent the conditional indepence graph of a Gaussian graphical model.

Usage

GGMnetworkStats(sparseP, as.table = FALSE)

Arguments

sparseP

Sparse precision/partial correlation matrix.

as.table

A logical indicating if the output should be in tabular format.

Details

The function calculates various network statistics from a sparse matrix. The input matrix P is assumed to be a sparse precision or partial correlation matrix. The sparse matrix is taken to represent a conditional independence graph. In the Gaussian setting, conditional independence corresponds to zero entries in the (standardized) precision matrix. Each node in the graph represents a Gaussian variable, and each undirected edge represents conditional dependence in the sense of a nonzero corresponding precision entry.

The function calculates various measures of centrality: node degree, betweenness centrality, closeness centrality, and eigenvalue centrality. It also calculates the number of positive and the number of negative edges for each node. In addition, for each variate the mutual information (with all other variates), the variance, and the partial variance is represented. It is also indicated if the graph is chordal (i.e., triangulated). For more information on network measures, consult, e.g., Newman (2010).

Value

An object of class list when as.table = FALSE:

degree

A numeric vector with the node degree for each node.

betweenness

A numeric vector representing the betweenness centrality for each node.

closeness

A numeric vector representing the closeness centrality for each node.

eigenCentrality

A numeric vector representing the eigenvalue centrality for each node.

nNeg

An integer vector representing the number of negative edges for each node.

nPos

An integer vector representing the number of positive edges for each node.

chordal

A logical indicating if the implied graph is chordal.

mutualInfo

A numeric vector with the mutual information (with all other nodes) for each node.

variance

A numeric vector representing the variance of each node.

partialVariance

A numeric vector representing the partial variance of each node.

When as.table = TRUE the list items above (with the exception of chordal) are represented in tabular form as an object of class matrix.

Author(s)

Carel F.W. Peeters <carel.peeters@wur.nl>, Wessel N. van Wieringen

References

Newman, M.E.J. (2010). "Networks: an introduction", Oxford University Press.

See Also

ridgeP, covML, sparsify, Ugraph

Examples


## Obtain some (high-dimensional) data
p = 25
n = 10
set.seed(333)
X = matrix(rnorm(n*p), nrow = n, ncol = p)
colnames(X)[1:25] = letters[1:25]
Cx <- covML(X)

## Obtain sparsified partial correlation matrix
Pridge   <- ridgeP(Cx, 10, type = "Alt")
PCsparse <- sparsify(Pridge , threshold = "top")$sparseParCor

## Represent the graph and calculate GGM network statistics
Ugraph(PCsparse, "fancy")
## Not run: GGMnetworkStats(PCsparse)


rags2ridges documentation built on Oct. 14, 2023, 5:06 p.m.