adjacentMat {rags2ridges}R Documentation

Transform real matrix into an adjacency matrix

Description

Function that transforms a real matrix into an adjacency matrix. Intended use: Turn sparsified precision matrix into an adjacency matrix for undirected graphical representation.

Usage

adjacentMat(M, diag = FALSE)

Arguments

M

(Possibly sparsified precision) matrix.

diag

A logical indicating if the diagonal elements should be retained.

Value

Function returns an adjacency matrix.

Author(s)

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

See Also

ridgeP, covML, sparsify, edgeHeat, 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 regularized precision matrix
P <- ridgeP(Cx, lambda = 10, type = "Alt")

## Obtain sparsified partial correlation matrix
PC0 <- sparsify(P, threshold = "localFDR", FDRcut = .8)

## Obtain adjacency matrix
adjacentMat(PC0$sparsePrecision)


[Package rags2ridges version 2.2.7 Index]