convertGraph | R Documentation |
Convert into adjacency matrices NG
graphs (expressed as
lists of connected nodes)
convertGraph(Graph)
Graph |
array of dimension
|
An array of dimension p x p x NG
, or,
when NG
is equal to 1, a matrix
of dimension p x p
.
The entry [,,iG]
is a symmetric matrix, with diagonal equal to
zero. The entry [a,b,iG]
is equal to 1 if a
is connected to b
,
0 otherwise.
This function is useful to generate the entry
MyFamily
of the function selectMyFam
.
Actually, the list of adjacency matrices MyFamily
can be generated from lists of connected nodes with
convertGraph
.
Bouvier A, Giraud C, Huet S, Verzelen N
Please use citation("GGMselect")
selectQE
, selectMyFam
,
selectFast
, simulateGraph
,
penalty
p=30
n=30
# simulate graph
eta=0.11
Gr <- simulateGraph(p,eta)
X <- rmvnorm(n, mean=rep(0,p), sigma=Gr$C)
# estimate graph
GRest <- selectFast(X, family="C01")
# Neighb and G are 2 forms of the same result
a <- convertGraph(GRest$C01$Neighb)
print(all.equal(a, GRest$C01$G)) # TRUE
# recalculate the graph with selectMyFam
GMF <- selectMyFam(X, list(a))
print(all.equal(a,GMF$G)) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.