Learn R Programming

rags2ridges (version 1.2)

Ugraph: Visualize undirected graph

Description

Function that visualizes the sparsified precision matrix as an undirected graph.

Usage

Ugraph(M, type = c("plain", "fancy", "weighted"), lay = layout.circle, Vsize = 15, 
Vcex = 1, Vcolor = "orangered", VBcolor = "darkred", VLcolor = "black", 
prune = FALSE, legend = FALSE, label = "", Lcex = 1.3, PTcex = 4, cut = 0.5, 
scale = 10, pEcolor = "black", nEcolor = "grey", main = "")

Arguments

M
(Possibly sparsified) precision matrix
type
A character indicating the type of graph to be produced. Must be one of: "plain", "fancy", "weighted".
lay
Function call to igraph determining the placement of vertices.
Vsize
A numeric determining the vertex size.
Vcex
A numeric determining the size of the vertex labels.
Vcolor
A character determining the vertex color.
VBcolor
A character determining the color of the vertex border.
VLcolor
A character determining the color of the vertex labels.
prune
A logical determining if vertices of degree 0 should be removed.
legend
A logical indicating if the graph should come with a legend.
label
A character giving a name to the legend label.
Lcex
A numeric determining the size of the legend box.
PTcex
A numeric determining the size of the exemplary vertex in the legend box.
cut
A numeric indicating the cut-off for indicating strong edges when type = "fancy".
scale
A numeric representing a scale factor for visualizing strenght of edges when type = "weighted".
pEcolor
A character determining the color of the edges tied to positive precision elements. Only when type = "weighted".
nEcolor
A character determining the color of the edges tied to negative precision elements. Only when type = "weighted".
main
A character giving the main figure title.

Details

The intended use of this function is to visualize a sparsified precision/partial correlation matrix as an undirected graph. When type = "plain" a plain undirected graph is given representing the conditional (in)dependencies exemplified by the sparsified precision. When type = "fancy" a more elaborate graph is given in which dashed lines indicate negative partial correlations while solid lines indicate positive partial correlations, and in which black lines indicate strong edges. Strong edges are deemed such by setting cut. If a the absolute value of a precision element $\geq$ cut the corresponding edge is deemed strong and colored black in the graph. The argument cut is thus only used when type = "fancy". When type = "weighted" an undirected graph is given in which edge thickness represents the strenght of the partial correlations. The nEcolor colored edges then represent negative partial correlations while pEcolor colored edges represent positive partial correlations. (Relative) edge thickness in this type of graph can be set by the argument scale. The arguments scale, nEcolor, and pEcolor are thus only used when type = "weighted". The default layout gives a circular placement of the vertices. All layout functions supported by igraph are supported (the function is partly a wrapper around certain igraph functions). The legend allows one to specify the kind of variable the vertices represent, such as, e.g., mRNA transcripts. The arguments label, Lcex, and PTcex are only used when legend = TRUE. If prune = TRUE the vertices of degree 0 (vertices not implicated by any edge) are removed. For the colors supported by the arguments Vcolor, VBcolor, VLcolor, pEcolor, and nEcolor see www.stat.columbia.edu/~tzheng/files/Rcolor.pdf.

References

Csardi, G. and Nepusz, T. (2006). The igraph software package for complex network research. InterJournal, Complex Systems 1695. http://igraph.sf.net van Wieringen, W.N. and Peeters, C.F.W. (2014). Ridge Estimation of Inverse Covariance Matrices from High-Dimensional Data. arXiv:1403.0904 [stat.ME].

See Also

ridgeS, optPenaltyCV, optPenalty.aLOOCV, sparsify

Examples

Run this code
## 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]

## Obtain regularized precision under optimal penalty
OPT <- optPenaltyCV(X, 12, 20, 10)

## Determine support regularized (standardized) precision under optimal penalty
PC0 <- sparsify(symm(OPT$optPrec), type = "localFDR")

## Obtain graphical representation
Ugraph(PC0, type = "fancy", cut = 0.05)

Run the code above in your browser using DataLab