Learn R Programming

GGMselect (version 0.1-0)

selectMyFam: Select a graph within a given family of graphs in Gaussian Graphical Modeling.

Description

Select a graph within a given family of graphs.

Usage

selectMyFam(X, MyFamily, K=2.5, min.ev=10**(-8))

Arguments

X
n x p matrix where n is the sample size and p the number of variables. n should be greater than 3 and p greater than 1.
MyFamily
list of pxp adjacency matrices corresponding to graphs with degree less or equal to n-3.
K
scalar or vector with values larger than 1. Tuning parameter of the penalty function.
min.ev
minimum eigenvalue for matrix inversion.

Value

  • Neighbarray of dimension p x dmax x length(K) where dmax is the maximum degree of the graphs in MyFamily. When K is of length 1, matrix of dimension p x dmax. Neighb[a, , k ] contains the indices of the nodes connected to node a for K[k].
  • crit.minvector of dimension length(K). The minimal values of the selection criterion for each value of K.
  • ind.minvector of dimension length(K). Indices of the families for which the criterion is minimum.
  • Garray of dimension p x p x length(K) or, when length(K) equals 1, matrix of dimension p x p. G[,,k] gives the adjacency matrix for K[k].

Details

More details are available on ../doc/Notice.pdf

References

Please use citation("GGMselect").

See Also

selectFast, selectQE, simulateGraph, penalty, convertGraph

Examples

Run this code
p=30
n=30
# generate graph
eta=0.11
Gr <- simulateGraph(p,eta)
# generate data
X <- rmvnorm(n, mean=rep(0,p), sigma=Gr$C)
# generate a family of candidate graphs with glasso
library("glasso")
MyFamily <- NULL
for (j in 1:3){
  MyFamily[[j]] <- abs(sign(glasso(cov(X),rho=j/5)$wi))
  diag(MyFamily[[j]]) <- 0
}
# select a graph within MyFamily
GMF <- selectMyFam(X,MyFamily)
# plot the result
library(network)
par(mfrow=c(1,2))
gV <- network(Gr$G)
plot(gV,jitter=TRUE, usearrows = FALSE, label=1:p,displaylabels=TRUE)
gMyFam <- network(GMF$G)
plot(gMyFam, jitter=TRUE, usearrows = FALSE,  label=1:p,displaylabels=TRUE)

Run the code above in your browser using DataLab