InducedGraphs: Graphs induced by marginalization or conditioning

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Functions to find induced graphs after conditioning on a set of variables and marginalizing over another set.

Usage

1
2
3
4
5
inducedCovGraph(amat, sel = rownames(amat), cond = NULL)
inducedConGraph(amat, sel = rownames(amat), cond = NULL)
inducedRegGraph(amat, sel = rownames(amat), cond = NULL)
inducedChainGraph(amat, cc=rownames(amat), cond = NULL, type="LWF")
inducedDAG(amat, order, cond = NULL)

Arguments

amat

a square Boolean matrix, the adjacency matrix of a directed acyclic graph. The names of rows and of the columns are the nodes of the DAG.

sel

a character vector representing a subset of selected variables. The elements of the vector must be a subset of the names of the nodes i.e. of rownames(A). By default sel is the set of the nodes of the DAG.

cond

a character vector representing the variables on which you want to condition. cond must be disjoint from sel and their union must be a subset of the set of nodes. The set difference between the set of nodes and the union of sel and cond are the variables over which we marginalize. cond may be the null vector (the default), meaning that you want to condition on the empty set.

cc

a list of character vectors specifying the chain components for the chain graph.

type

a string indicating the interpretation of the chain graph. It can be either "LWF" (Lauritzen, Wermuth, Frydenberg interpretation), "AMP" (Andersson, Madigan, Perlman interpretation) or "MRG" (Multivariate regression graph interpretation).

order

a character vector indicating the ordering of the vertices of a DAG (left to right, past to future).

Details

Given a directed acyclic graph representing a set of conditional independencies it is possible to obtain other graphs of conditional independence implied after marginalizingover and conditionig on sets of nodes. Such graphs are the covariance graph, the concentration graph, the multivariate regression graph and the chain graph with different interpretations (see Cox \& Wermuth, 1996, 2004).

Value

inducedCovGraph returns the adjacency matrix of the covariance graph of the variables in set sel given the variables in set cond, implied by the original directed acyclic graph with adjacency matrix amat.

inducedConGraph returns the adjacency matrix of the concentration graph of the variables in set sel given the variables in set cond, implied by the original directed acyclic graph with adjacency matrix amat.

inducedRegGraph returns the adjacency matrix of the multivariate regression graph of the variables in set sel given the variables in set cond, implied by the original directed acyclic graph with adjacency matrix amat.

inducedChainGraph returns the adjacency matrix of the chain graph for the variables in chain components cc, given the variables in set cond, with interpretation specified by string type, implied by the original directed acyclic graph with adjacency matrix amat.

inducedDAG returns the adjacency matrix of the DAG with the ordering order, implied by the original directed acyclic graph with adjacency matrix amat.

Note

If sel is NULL the functions return the null matrix. If cond is NULL, the conditioning set is empty and the functions inducedConGraph and inducedCovGraph return the overall induced covariance or concentration matrices of the selected variables. If you do not specify sel you cannot specify a non NULL value of cond.

Author(s)

Giovanni M. Marchetti

References

Cox, D. R. \& Wermuth, N. (1996). Multivariate dependencies. London: Chapman \& Hall.

Wermuth, N. \& Cox, D.R. (2004). Joint response graphs and separation induced by triangular systems. J.R. Statist. Soc. B, 66, Part 3, 687-717.

See Also

DAG, UG,isAcyclic

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
## Define a DAG
dag <- DAG(a ~ x, c ~ b+d, d~ x)
dag
## Induced covariance graph of a, b, d given the empty set.
inducedCovGraph(dag, sel=c("a", "b", "d"), cond=NULL)

## Induced concentration graph of a, b, c given x
inducedConGraph(dag, sel=c("a", "b", "c"), cond="x")

## Overall covariance graph
inducedCovGraph(dag)

## Overall concentration graph
inducedConGraph(dag)

## Induced covariance graph of x, b, d given c, x.
inducedCovGraph(dag, sel=c("a", "b", "d"), cond=c("c", "x"))

## Induced concentration graph of a, x, c given d, b.
inducedConGraph(dag, sel=c("a", "x", "c"), cond=c("d", "b"))

## The DAG on p. 198 of Cox & Wermuth (1996)
dag <- DAG(y1~ y2 + y3, y3 ~ y5, y4 ~ y5)

## Cf. figure 8.7 p. 203 in Cox & Wermuth (1996)
inducedCovGraph(dag, sel=c("y2", "y3", "y4", "y5"), cond="y1")
inducedCovGraph(dag, sel=c("y1", "y2", "y4", "y5"), cond="y3")
inducedCovGraph(dag, sel=c("y1", "y2", "y3", "y4"), cond="y5")

## Cf. figure 8.8 p. 203 in Cox & Wermuth (1996)
inducedConGraph(dag, sel=c("y2", "y3", "y4", "y5"), cond="y1")
inducedConGraph(dag, sel=c("y1", "y2", "y4", "y5"), cond="y3")
inducedConGraph(dag, sel=c("y1", "y2", "y3", "y4"), cond="y5")

## Cf. figure 8.9 p. 204 in Cox & Wermuth (1996)
inducedCovGraph(dag, sel=c("y2", "y3", "y4", "y5"), cond=NULL)
inducedCovGraph(dag, sel=c("y1", "y2", "y4", "y5"), cond=NULL)
inducedCovGraph(dag, sel=c("y1", "y2", "y3", "y4"), cond=NULL)

## Cf. figure 8.10 p. 204 in Cox & Wermuth (1996)
inducedConGraph(dag, sel=c("y2", "y3", "y4", "y5"), cond=NULL)
inducedConGraph(dag, sel=c("y1", "y2", "y4", "y5"), cond=NULL)
inducedConGraph(dag, sel=c("y1", "y2", "y3", "y4"), cond=NULL)

## An induced regression graph
dag2 = DAG(Y ~ X+U, W ~ Z+U)
inducedRegGraph(dag2, sel="W",  cond=c("Y", "X", "Z"))

## An induced DAG
inducedDAG(dag2, order=c("X","Y","Z","W"))

## An induced multivariate regression graph
inducedRegGraph(dag2, sel=c("Y", "W"), cond=c("X", "Z"))

## An induced chain graph with LWF interpretation
dag3 = DAG(X~W, W~Y, U~Y+Z)
cc = list(c("W", "U"), c("X", "Y", "Z"))
inducedChainGraph(dag3, cc=cc, type="LWF")

## ... with AMP interpretation
inducedChainGraph(dag3, cc=cc, type="AMP")

## ... with multivariate regression interpretation
cc= list(c("U"), c("Z", "Y"), c("X", "W"))
inducedChainGraph(dag3, cc=cc, type="MRG")

Example output

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

  a x c b d
a 0 0 0 0 0
x 1 0 0 0 1
c 0 0 0 0 0
b 0 0 1 0 0
d 0 0 1 0 0
    a b   d
a   0 0 100
b   0 0   0
d 100 0   0
  a  b  c
a 0  0  0
b 0  0 10
c 0 10  0
    a   x   c   b   d
a   0 100 100   0 100
x 100   0 100   0 100
c 100 100   0 100 100
b   0   0 100   0   0
d 100 100 100   0   0
   a  x  c  b  d
a  0 10  0  0  0
x 10  0  0  0 10
c  0  0  0 10 10
b  0  0 10  0 10
d  0 10 10 10  0
  a   b   d
a 0   0   0
b 0   0 100
d 0 100   0
   a  x c
a  0 10 0
x 10  0 0
c  0  0 0
    y2  y3  y4  y5
y2   0 100 100 100
y3 100   0 100 100
y4 100 100   0 100
y5 100 100 100   0
    y1  y2  y4  y5
y1   0 100   0   0
y2 100   0   0   0
y4   0   0   0 100
y5   0   0 100   0
    y1  y2  y3 y4
y1   0 100 100  0
y2 100   0   0  0
y3 100   0   0  0
y4   0   0   0  0
   y2 y3 y4 y5
y2  0 10  0  0
y3 10  0  0 10
y4  0  0  0 10
y5  0 10 10  0
   y1 y2 y4 y5
y1  0 10  0  0
y2 10  0  0  0
y4  0  0  0 10
y5  0  0 10  0
   y1 y2 y3 y4
y1  0 10 10  0
y2 10  0 10  0
y3 10 10  0  0
y4  0  0  0  0
   y2  y3  y4  y5
y2  0   0   0   0
y3  0   0 100 100
y4  0 100   0 100
y5  0 100 100   0
    y1  y2  y4  y5
y1   0 100 100 100
y2 100   0   0   0
y4 100   0   0 100
y5 100   0 100   0
    y1  y2  y3  y4
y1   0 100 100 100
y2 100   0   0   0
y3 100   0   0 100
y4 100   0 100   0
   y2 y3 y4 y5
y2  0  0  0  0
y3  0  0  0 10
y4  0  0  0 10
y5  0 10 10  0
   y1 y2 y4 y5
y1  0 10  0 10
y2 10  0  0 10
y4  0  0  0 10
y5 10 10 10  0
   y1 y2 y3 y4
y1  0 10 10  0
y2 10  0 10  0
y3 10 10  0 10
y4  0  0 10  0
  W
Y 1
X 1
Z 1
  X Y Z W
X 0 1 0 1
Y 0 0 0 1
Z 0 0 0 1
W 0 0 0 0
  Y W
X 1 0
Z 0 1
   W  U X  Y  Z
W  0 10 1  1  0
U 10  0 0  1  1
X  0  0 0  0  0
Y  0  0 0  0 10
Z  0  0 0 10  0
   W  U X  Y  Z
W  0 10 1  1  1
U 10  0 0  1  1
X  0  0 0  0  0
Y  0  0 0  0 10
Z  0  0 0 10  0
  U   Z   Y   X   W
U 0   1   1   0   0
Z 0   0 100   0   0
Y 0 100   0   1   1
X 0   0   0   0 100
W 0   0   0 100   0

ggm documentation built on March 26, 2020, 7:49 p.m.

Related to InducedGraphs in ggm...