Learn R Programming

ggm (version 0.5)

InducedGraphs: Graphs induced by marginalization or conditioning

Description

Functions to find the induced covariance or concentration graphs after conditioning on a set of variables and marginalising over another set.

Usage

inducedCovGraph(A, sel = 1:nrow(A), cond = NULL)
inducedConGraph(A, sel = 1:nrow(A), cond = NULL)

Arguments

A
a Boolean matrix with dimnames representing a directed acyclic graph. The function does not check if this is the case. See the function is.acyclic
sel
a vector representing a subset of selected of variables. The vector should be a character vector of the names of the variables matching the names of the nodes in rownames(A). It can be also a numeric vector of indices. By defau
cond
a set of nodes representing the variables on which you want to condition. The mode of this vector must match the mode of sel. cond must be disjoint from sel and their union must be a subset of the set of

Value

  • inducedCovGraph returns the edge 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 edge matrix A. inducedConGraph returns the edge 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 edge matrix A. If sel is NULL the functions return NULL or the null matrix. If cond is NULL, the conditioning set is empty and the functions return the marginal induced covariance or concentration matrices of the selected variables.

Details

Given a directed acyclic graph representing a set of conditional independencies it is possible to obtain other graphs of conditional independence implied after marginalizing over and conditionig on sets of nodes. Two such graphs are the covariance graph and the concentration graph (cfr. Cox & Wermuth, 1996, 2003).

References

Cox, D. R. & Wermuth, N. (1996). Multivariate dependencies. London: Chapman & Hall. Wermuth, N. & Cox, D.R. (2003). Joint response graphs and separation induced by triangular systems. Submitted and available at http://psystat.sowi.uni-mainz.de.

See Also

DAG, is.acyclic

Examples

Run this code
## 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 variables may be specified by numeric vectors (both)
inducedConGraph(dag, sel=c(1,4,2), cond=c(3, 5))

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

## Cfr. 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")

## Cfr. 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")

## Cfr. 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)

## Cfr. 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)

Run the code above in your browser using DataLab