= Conditional independence
{title2=$X\mathrel{\perp\!\!\!\perp}Y\mid Z$}
{wiki}
= Conditionally independent
{synonym}
<Random variables> $X$ and $Y$ are conditionally independent given $Z$ when, for every pair of <Borel sets> $A,B$, the following identity holds <almost surely>:
$$
\mathbb P(X\in A,Y\in B\mid Z)
=\mathbb P(X\in A\mid Z)\mathbb P(Y\in B\mid Z).
$$
Here <conditional probabilities> are <conditional expectations> of the corresponding <indicator random variables> given the <sigma-algebra> generated by $Z$. This defines the condition even when $\mathbb P(Z=z)=0$. In terms of <regular conditional distributions>, the conditional joint law is the product of the conditional <marginal distributions> for almost every conditioning value.
For <discrete random variables>, at every $z$ with $\mathbb P(Z=z)>0$, the condition becomes
$$
p_{X,Y\mid Z=z}(x,y)=p_{X\mid Z=z}(x)p_{Y\mid Z=z}(y).
$$
Where $\mathbb P(X=x,Z=z)>0$, this is equivalent to $\mathbb P(Y=y\mid X=x,Z=z)=\mathbb P(Y=y\mid Z=z)$. Once $Z$ is known, observing $X$ provides no further information about $Y$.<Information Theory I — Scene Setting and Statistical Applications (Lecture 9)>[Information Theory I — Scene Setting and Statistical Applications, Lecture 9, section Conditional independence and conditional mutual information: conditional factorization and predictive irrelevance]{ref}
For a worked example, suppose a <latent variable> $T$ chooses between two environments with $\mathbb P(T=0)=\mathbb P(T=1)=1/2$. Given $T=t$, take $X,Y$ to be <independent and identically distributed> with a <Bernoulli distribution> of parameter $p_t$, where $p_0=0.1$ and $p_1=0.9$. Think of two separate trials run under the same quiet or active environment. Their conditional <joint probability mass functions>, with rows $X=0,1$ and columns $Y=0,1$, are
$$
J_0=\begin{pmatrix}0.81&0.09\\0.09&0.01\end{pmatrix},\qquad
J_1=\begin{pmatrix}0.01&0.09\\0.09&0.81\end{pmatrix}.
$$
Each is exactly the product of its own conditional <marginal distributions>: $(0.9,0.1)$ for $T=0$, and $(0.1,0.9)$ for $T=1$. Thus $X,Y$ are <conditionally independent> given $T$.
If the environment is unobserved, the <law of total probability> averages the two tables:
$$
J=\tfrac12J_0+\tfrac12J_1
=\begin{pmatrix}0.41&0.09\\0.09&0.41\end{pmatrix}.
$$
Both unconditional <marginal distributions> are fair, but $0.41\ne0.5\times0.5$. The <law of total expectation> gives
$$
\mathbb E[X]=\mathbb E[Y]=0.5,\qquad
\mathbb E[XY]=\tfrac12(0.1^2+0.9^2)=0.41,\qquad
\operatorname{Cov}(X,Y)=0.41-0.25=0.16.
$$
\Image[/conditional-independence-shared-environment-tables.png]
{title=An unobserved shared environment creates <statistical dependence> between <conditionally independent> trials}
{description=The first two tables show independent <Bernoulli trials> at conditional success <probabilities> $0.1$ and $0.9$. Averaging them with equal weights gives the third table. The fourth table is the product of the resulting unconditional <marginal distributions>, which differs from the actual joint table. These are stipulated model probabilities, not observed frequencies.}
Observing $X=1$ makes the active environment more plausible, so it raises $\mathbb P(Y=1\mid X=1)$ to $0.41/0.5=0.82$. Knowing the actual environment removes this source of <statistical dependence>. The <covariance induced by a shared latent variable> lemma explains the calculation without listing all the outcomes.
This is why <conditional independence> is useful in <statistical modelling>: a model can multiply simple conditional laws and then average over a shared <latent variable>. The resulting observations can remain statistically dependent. <Conditional independence graphs> organize such information relations; their interpretation as causes requires additional assumptions from <causal inference>. Conditioning describes the information available to an observer. It does not, by itself, describe what would happen if an experimenter changed a variable.
Back to article page