learn.graph {lcd} | R Documentation |
Learns chain graphs structures via decomposition algorithms with normal or multinomial data.
learn.complex.norm(skel, cov, n, p.value) learn.mec.norm(tree, cov, n, p.value, method = "CG") learn.skeleton.norm(tree, cov, n, p.value, drop = TRUE) learn.complex.multinom(skel, freq.tb, p.value) learn.mec.multinom(tree, freq.tb, p.value, method = "CG") learn.skeleton.multinom(tree, freq.tb, p.value, drop = TRUE) learn.v(skel, tree)
skel |
the object returned by learn.skeleton.norm function. |
tree |
an object of class sep.tree , e.g.,
the separation tree obtained via ug.to.jtree . |
cov |
the covariance matrix of the data |
n |
number of random samples used to obtain the covariance matrix. |
freq.tb |
the frequency table of the data, should be an object
from class freq.tb . |
p.value |
thresholding p-value for conditional independence test during the learning procedure. |
method |
a character string, must be one of "CG", "DAG" and "UG", telling the alogrithm whether the underlying graph is a DAG, undirected graph or more generally a chain graph. |
drop |
logical value, with default=TRUE , whether to drop possibly
extra edges after recovering and combining local skeletons. |
learn.mec.norm
is the wrapper function for
learn.skeleton.norm
, learn.complex.norm
and learn.v
for normal data, which is intended to be mostly called by the
user. learn.mec.multinom
is the counterpart for discrete
data. The user specifies
whether she/he is learning an undirected graph (Markov network), a DAG
(Bayesian network) or in general a chain graph by supplying the
specific string to the method
argument. The function itself
will utilize the correct helper functions to perform the structural
learning and return the pattern (representing the Markov equivalent
class) of the graph.
learn.skeleton.norm
and learn.skeleton.multinom
try to learn the skeleton of the
graph. learn.v
, learn.complex.norm
(or
learn.complex.multinom
) are for v-structure/complex discovery
in DAG/chain graph respectively.
Some parts of the code of these learning functions are adapted from
the code for pcAlgo
function in the R
package
pcalg
written by Markus Kalisch and Martin Maechler.
learn.mec.norm
, learn.mec.multinom
, learn.v
,
learn.complex.norm
, learn.complex.multinom
return the
pattern of the graph, represented in its adjacency matrix.
learn.skeleton.norm
and learn.skeleton.multinom
return a
list of the following two items:
amat |
the adjacency matrix of the learned skeleton. |
sep.pairs |
a list of sep.pair objects, recording the
separation pairs we obtained during the skeleton learning procedure. |
Zongming Ma and Xiangrui Meng
Ma, Z., Xie, X. and Geng, Z. (2008). Structural learning of chain graphs via decomposition. J. Mach. Learn. Res., 9, 2847-2880.
Xie, X., Geng, Z. and Zhao, Q. (2006). Decomposition of structural learning about directed acyclic graphs. Artif. Intell., 170, 422-439.
set.seed(100) p.value <- .01 n <- 3000 is.chaingraph(toy.graph) tgdata <- rnorm.cg(n, toy.graph, get.normal.dist(toy.graph)) tgug <- naive.getug.norm(tgdata, p.value) tg.jtree <- ug.to.jtree(tgug) tg.pat <- learn.mec.norm(tg.jtree, cov(tgdata), n, p.value, "CG") comp.skel(skeleton(toy.graph), skeleton(tg.pat)) comp.pat(pattern(toy.graph), tg.pat)