Description Usage Arguments Details Value Author(s) References See Also Examples
Defines a loopless mixed graph from the directed, undirected and undirected components.
1 |
dg |
the adjacency matrix of a directed graph specifying the arrows of the mixed graph. |
ug |
the adjacency matrix of an undirected graph specifying the lines of the mixed graph. |
bg |
the adjacency matrix of an undirected graph specifying the bidirected edges of the mixed graph. |
A loopless mixed graph is a mixed graph with three types of edges: undirected,
directed and bi-directed edges.
Note that the three adjacency matrices must have labels and
may be defined using the functions DG
, DAG
or UG
.
The adjacency matrices of the undirected graphs may be just
symmetric Boolean matrices.
a square matrix obtained by combining the three graph components into an adjacency matrix of a mixed graph. The matrix 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.
Giovanni M. Marchetti, Mathias Drton
Richardson, T. S. and Spirtes, P. (2002). Ancestral Graph Markov Models. Annals of Statistics, 30(4), 962–1030.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Examples from Richardson and Spirtes (2002)
a1 <- makeMG(dg=DAG(a~b, b~d, d~c), bg=UG(~a*c))
isAG(a1) # Not an AG. (a2) p.969
a2 <- makeMG(dg=DAG(b ~ a, d~c), bg=UG(~a*c+c*b+b*d)) # Fig. 3 (b1) p.969
isAG(a1)
a3 <- makeMG(ug = UG(~ a*c), dg=DAG(b ~ a, d~c), bg=UG(~ b*d)) # Fig. 3 (b2) p.969
a5 <- makeMG(bg=UG(~alpha*beta+gamma*delta), dg=DAG(alpha~gamma,
delta~beta)) # Fig. 6 p. 973
## Another Example
a4 <- makeMG(ug=UG(~y0*y1), dg=DAG(y4~y2, y2~y1), bg=UG(~y2*y3+y3*y4))
## A mixed graphs with double edges.
mg <- makeMG(dg = DG(Y ~ X, Z~W, W~Z, Q~X), ug = UG(~X*Q),
bg = UG(~ Y*X+X*Q+Q*W + Y*Z) )
## Chronic pain data: a regression graph
chronic.pain <- makeMG(dg = DAG(Y ~ Za, Za ~ Zb + A, Xa ~ Xb,
Xb ~ U+V, U ~ A + V, Zb ~ B, A ~ B), bg = UG(~Za*Xa + Zb*Xb))
|
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
Attaching package: 'ggm'
The following object is masked from 'package:igraph':
pa
[1] FALSE
Warning message:
In isAG(a1) : Spouses cannot be ancestors.
[1] FALSE
Warning message:
In isAG(a1) : Spouses cannot be ancestors.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.