
Last chance! 50% off unlimited learning
Sale ends in
MAG
generates and plots maximal ancestral graphs after marginalisation
and conditioning.
MAG(amat,M=c(),C=c(),showmat=TRUE,plot=FALSE, plotfun = plotGraph, …)
An adjacency matrix, or a graph that can be a graphNEL
or an igraph
object
or a vector of length "a"
(arrows from node1 to node2), "b"
(arcs), and
"l"
(lines).
A subset of the node set of a
that is going to be marginalized over
Another disjoint subset of the node set of a
that is going to be
conditioned on.
A logical value. TRUE
(by default) to print the generated matrix.
A logical value, FALSE
(by default). TRUE
to plot
the generated graph.
Function to plot the graph when plot == TRUE
. Can be plotGraph
(the default) or drawGraph
.
Further arguments passed to plotfun
.
A matrix that consists 4 different integers as an
Richardson, T. S. and Spirtes, P. (2002). Ancestral graph Markov models. Annals of Statistics, 30(4), 962-1030.
Sadeghi, K. (2011). Stable classes of graphs containing directed acyclic graphs. Submitted.
Sadeghi, K. and Lauritzen, S.L. (2011). Markov properties for loopless mixed graphs. Submitted. URL http://arxiv.org/abs/1109.5909.
# NOT RUN {
ex<-matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ##The adjacency matrix of a DAG
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0), 16, 16, byrow = TRUE)
M <- c(3,5,6,15,16)
C <- c(4,7)
MAG(ex, M, C, plot=TRUE)
###################################################
H <- matrix(c(0,100,1,0,100,0,100,0,0,100,0,100,0,1,100,0),4,4)
Max(H)
# }
Run the code above in your browser using DataLab