AG {ggm} | R Documentation |
Ancestral graph
Description
AG
generates and plots ancestral graphs after marginalization
and conditioning.
Usage
AG(amat,M=c(),C=c(),showmat=TRUE,plot=FALSE, plotfun = plotGraph, ...)
Arguments
amat |
An adjacency matrix, or a graph that can be of class |
M |
A subset of the node set of |
C |
Another disjoint subset of the node set of |
showmat |
A logical value. |
plot |
A logical value, |
plotfun |
Function to plot the graph when |
... |
Further arguments passed to |
Value
A matrix that is the adjacency matrix of the generated graph.
It consists of 4 different integers as an ij
-element: 0 for a missing
edge between i
and j
, 1 for an arrow from i
to j
, 10 for a full line between
i
and j
, and 100 for a bi-directed arrow between i
and j
. These numbers are
added to be associated with multiple edges of different types. The matrix is
symmetric w.r.t full lines and bi-directed arrows.
Author(s)
Kayvan Sadeghi
References
Richardson, T.S. and Spirtes, P. (2002). Ancestral graph Markov models. Annals of Statistics, 30(4), 962-1030.
Sadeghi, K. (2013). Stable mixed graphs. Bernoulli 19(5B), 2330–2358.
See Also
Examples
##The adjacency matrix of a DAG
ex<-matrix(c(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,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)
AG(ex, M, C, plot = TRUE)