Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dconnected

d-Separation


Description

A set Z d-separates a path p if (1) Z contains a non-collider on p, e.g. x->m->y with Z=c("m"); or (2) some collider on p is not on Z, e.g. x->m<-y with Z=c().

Usage

dconnected(x, X, Y = list(), Z = list())

dseparated(x, X, Y = list(), Z = list())

Arguments

x

the input graph, a DAG, PDAG, or MAG.

X

vector of variable names.

Y

vector of variable names.

Z

vector of variable names.

dseparated(x,X,Y,Z) checks if all paths between X and Y are d-separated by Z.

dconnected(x,X,Y,Z) checks if at least one path between X and Y is not d-separated by Z.

Details

The functions also work for mixed graphs with directed, undirected, and bidirected edges. The definition of a collider in such graphs is: a node where two arrowheads collide, e.g. x<->m<-y but not x->m–y.

Examples

dconnected( "dag{x->m->y}", "x", "y", c() ) # TRUE
dconnected( "dag{x->m->y}", "x", "y", c("m") ) # FALSE
dseparated( "dag{x->m->y}", "x", "y", c() ) # FALSE 
dseparated( "dag{x->m->y}", "x", "y", c("m") ) # TRUE

dagitty

Graphical Analysis of Structural Causal Models

v0.3-1
GPL-2
Authors
Johannes Textor, Benito van der Zander, Ankur Ankan
Initial release
2021-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.