| selectMyFam {GGMselect} | R Documentation |
Select a graph within a given family of graphs.
selectMyFam(X, MyFamily, K=2.5, min.ev=10**(-8))
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. |
More details are available on ../doc/Notice.pdf
Neighb |
array 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.min |
vector of dimension length(K).
The minimal values of the selection criterion
for each value of K. |
ind.min |
vector of dimension length(K).
Indices of the families for which the criterion is minimum. |
G |
array 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]. |
Adjacency matrices can be generated from lists of connected nodes
by using the function convertGraph
Bouvier A, Giraud C, Huet S, Verzelen N.
Please use citation("GGMselect").
selectFast, selectQE,
simulateGraph, penalty,
convertGraph
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)