This note examines the dependence between variables in three types of directed acyclic graphs (DAGs): pipe, confounder, and collider.

Pipe DAG

In the pipe DAG, variables X and Z are independent when conditioned on Y; mathematically, this can be expressed as

\[P(X,Z \mid Y) = P(X\mid Y) P(Z\mid Y).\]

This can be proven using the Bayesian theorem (in steps 1 and 3 below) and Markov property of the DAG (in step 2 below):

\[\begin{align*} P(X,Z\mid Y) &= \frac{P(X,Y,Z)}{P(Y)} \\ &= \frac{P(Z\mid Y) P(Y\mid X) P(X)}{P(Y)}\\ & = P(Z\mid Y) P(X\mid Y). \end{align*}\]

Confounder DAG

In the DAG with a confounder, $X$ and $Y$ are independent when conditioned on $Z$; mathematically, this is

\[P(X,Y \mid Z) = P(X\mid Z) P(Y\mid Z),\]

which is also proved using the Bayesian theorem and Markov property of the DAG:

\[\begin{align*} P(X,Y\mid Z) &= \frac{P(X,Y,Z)}{P(Z)} \\ &= \frac{P(X\mid Z) P(Y\mid Z) P(Z)}{P(Z)}\\ & = P(X\mid Z) P(Y\mid Z). \end{align*}\]

Collider DAG

Finally, in the DAG with a collider, $X$ and $Y$ are dependent when conditioned on $Z$; mathematically expressed as

\[P(X,Y \mid Z) \neq P(X\mid Z) P(Y\mid Z).\]

This is demonstrated by showing that $P(X,Y\mid Z)$ cannot be equal to $P(X\mid Z) P(Y\mid Z)$:

\[\begin{align*} P(X,Y\mid Z) &= \frac{P(X,Y,Z)}{P(Z)} \\ &= \frac{P(Z\mid X) P(Z\mid Y) P(X) P(Y)}{P(Z)}\\ & = \left (\frac{P(Z\mid X)P(X)}{P(Z)}\right) \left(\frac{P(Z\mid Y)P(Y)}{P(Z)}\right)P(Z)\\ & = P(X\mid Z) P(Y\mid Z) P(Z) \\ & \neq P(X\mid Z) P(Y\mid Z). \end{align*}\]