Conditional independence

From HandWiki
Short description: Probability theory concept

In probability theory, conditional independence describes situations wherein an observation is irrelevant or redundant when evaluating the certainty of a hypothesis. Conditional independence is usually formulated in terms of conditional probability, as a special case where the probability of the hypothesis given the uninformative observation is equal to the probability without. If [math]\displaystyle{ A }[/math] is the hypothesis, and [math]\displaystyle{ B }[/math] and [math]\displaystyle{ C }[/math] are observations, conditional independence can be stated as an equality:

[math]\displaystyle{ P(A\mid B,C) = P(A \mid C) }[/math]

where [math]\displaystyle{ P(A \mid B, C) }[/math] is the probability of [math]\displaystyle{ A }[/math] given both [math]\displaystyle{ B }[/math] and [math]\displaystyle{ C }[/math]. Since the probability of [math]\displaystyle{ A }[/math] given [math]\displaystyle{ C }[/math] is the same as the probability of [math]\displaystyle{ A }[/math] given both [math]\displaystyle{ B }[/math] and [math]\displaystyle{ C }[/math], this equality expresses that [math]\displaystyle{ B }[/math] contributes nothing to the certainty of [math]\displaystyle{ A }[/math]. In this case, [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] are said to be conditionally independent given [math]\displaystyle{ C }[/math], written symbolically as: [math]\displaystyle{ (A \perp\!\!\!\perp B \mid C) }[/math]. In the language of causal equality notation, two functions [math]\displaystyle{ f(y) }[/math] and [math]\displaystyle{ g(y) }[/math] which both depend on a common variable [math]\displaystyle{ y }[/math] are described as conditionally independent using the notation [math]\displaystyle{ f\left(y\right) ~\overset{\curvearrowleft \curvearrowright }{=}~ g\left(y\right) }[/math], which is equivalent to the notation [math]\displaystyle{ P(f\mid g,y) = P(f \mid y) }[/math].

The concept of conditional independence is essential to graph-based theories of statistical inference, as it establishes a mathematical relation between a collection of conditional statements and a graphoid.

Conditional independence of events

Let [math]\displaystyle{ A }[/math], [math]\displaystyle{ B }[/math], and [math]\displaystyle{ C }[/math] be events. [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] are said to be conditionally independent given [math]\displaystyle{ C }[/math] if and only if [math]\displaystyle{ P(C) \gt 0 }[/math] and:

[math]\displaystyle{ P(A \mid B, C) = P(A \mid C) }[/math]

This property is often written: [math]\displaystyle{ (A \perp\!\!\!\perp B \mid C) }[/math], which should be read [math]\displaystyle{ ((A \perp\!\!\!\perp B) \vert C) }[/math].

Equivalently, conditional independence may be stated as:

[math]\displaystyle{ P(A,B|C) = P(A|C)P(B|C) }[/math]

where [math]\displaystyle{ P(A,B|C) }[/math] is the joint probability of [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] given [math]\displaystyle{ C }[/math]. This alternate formulation states that [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] are independent events, given [math]\displaystyle{ C }[/math].

It demonstrates that [math]\displaystyle{ (A \perp\!\!\!\perp B \mid C) }[/math] is equivalent to [math]\displaystyle{ (B \perp\!\!\!\perp A \mid C) }[/math].

Proof of the equivalent definition

[math]\displaystyle{ P(A, B \mid C) = P(A\mid C)P(B\mid C) }[/math]
iff [math]\displaystyle{ \frac{P(A, B, C)}{P(C)} = \left(\frac{P(A, C)}{P(C)}\right) \left(\frac{P(B, C)}{P(C)} \right) }[/math]      (definition of conditional probability)
iff [math]\displaystyle{ P(A, B, C) = \frac{P(A, C) P(B, C)}{P(C)} }[/math]       (multiply both sides by [math]\displaystyle{ P(C) }[/math])
iff [math]\displaystyle{ \frac{P(A, B, C)}{P(B, C)}= \frac{P(A, C)}{P(C)} }[/math]       (divide both sides by [math]\displaystyle{ P(B, C) }[/math])
iff [math]\displaystyle{ P(A \mid B, C) = P(A \mid C) }[/math]       (definition of conditional probability) [math]\displaystyle{ \therefore }[/math]


Coloured boxes

Each cell represents a possible outcome. The events [math]\displaystyle{ \color{red}R }[/math], [math]\displaystyle{ \color{blue}B }[/math] and [math]\displaystyle{ \color{gold}Y }[/math] are represented by the areas shaded red, blue and yellow respectively. The overlap between the events [math]\displaystyle{ \color{red}R }[/math] and [math]\displaystyle{ \color{blue}B }[/math] is shaded purple.

These are two examples illustrating conditional independence.

The probabilities of these events are shaded areas with respect to the total area. In both examples [math]\displaystyle{ \color{red}R }[/math] and [math]\displaystyle{ \color{blue}B }[/math] are conditionally independent given [math]\displaystyle{ \color{gold}Y }[/math] because:

[math]\displaystyle{ \Pr({\color{red}R}, {\color{blue}B} \mid {\color{gold}Y}) = \Pr({\color{red}R} \mid {\color{gold}Y})\Pr({\color{blue}B} \mid {\color{gold}Y}) }[/math][1]

but not conditionally independent given [math]\displaystyle{ \left[ \text{not }{\color{gold}Y}\right] }[/math] because:

[math]\displaystyle{ \Pr({\color{red}R}, {\color{blue}B} \mid \text{not } {\color{gold}Y}) \not= \Pr({\color{red}R} \mid \text{not } {\color{gold}Y})\Pr({\color{blue}B} \mid \text{not } {\color{gold}Y}) }[/math]

Proximity and delays

Let events A and B be defined as the probability that person A and person B will be home in time for dinner where both people are randomly sampled from the entire world. Events A and B can be assumed to be independent i.e. knowledge that A is late has minimal to no change on the probability that B will be late. However, if a third event is introduced, person A and person B live in the same neighborhood, the two events are now considered not conditionally independent. Traffic conditions and weather-related events that might delay person A, might delay person B as well. Given the third event and knowledge that person A was late, the probability that person B will be late does meaningfully change.[2]

Dice rolling

Conditional independence depends on the nature of the third event. If you roll two dice, one may assume that the two dice behave independently of each other. Looking at the results of one dice will not tell you about the result of the second dice. (That is, the two dice are independent.) If, however, the 1st dice's result is a 3, and someone tells you about a third event - that the sum of the two results is even - then this extra unit of information restricts the options for the 2nd result to an odd number. In other words, two events can be independent, but NOT conditionally independent.[2]

Height and vocabulary

Height and vocabulary are dependent since very small people tend to be children, known for their more basic vocabularies. But knowing that two people are 19 years old (i.e., conditional on age) there is no reason to think that one person's vocabulary is larger if we are told that they are taller.

Conditional independence of random variables

Two discrete random variables [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are conditionally independent given a third discrete random variable [math]\displaystyle{ Z }[/math] if and only if they are independent in their conditional probability distribution given [math]\displaystyle{ Z }[/math]. That is, [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are conditionally independent given [math]\displaystyle{ Z }[/math] if and only if, given any value of [math]\displaystyle{ Z }[/math], the probability distribution of [math]\displaystyle{ X }[/math] is the same for all values of [math]\displaystyle{ Y }[/math] and the probability distribution of [math]\displaystyle{ Y }[/math] is the same for all values of [math]\displaystyle{ X }[/math]. Formally:

[math]\displaystyle{ (X \perp\!\!\!\perp Y) \mid Z \quad \iff \quad F_{X,Y\,\mid\,Z\,=\,z}(x,y) = F_{X\,\mid\,Z\,=\,z}(x) \cdot F_{Y\,\mid\,Z\,=\,z}(y) \quad \text{for all } x,y,z }[/math]






where [math]\displaystyle{ F_{X,Y\,\mid\,Z\,=\,z}(x,y)=\Pr(X \leq x, Y \leq y \mid Z=z) }[/math] is the conditional cumulative distribution function of [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] given [math]\displaystyle{ Z }[/math].

Two events [math]\displaystyle{ R }[/math] and [math]\displaystyle{ B }[/math] are conditionally independent given a σ-algebra [math]\displaystyle{ \Sigma }[/math] if

[math]\displaystyle{ \Pr(R, B \mid \Sigma) = \Pr(R \mid \Sigma)\Pr(B \mid \Sigma) \text{ a.s.} }[/math]

where [math]\displaystyle{ \Pr(A \mid \Sigma) }[/math] denotes the conditional expectation of the indicator function of the event [math]\displaystyle{ A }[/math], [math]\displaystyle{ \chi_A }[/math], given the sigma algebra [math]\displaystyle{ \Sigma }[/math]. That is,

[math]\displaystyle{ \Pr(A \mid \Sigma) := \operatorname{E}[\chi_A\mid\Sigma]. }[/math]

Two random variables [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are conditionally independent given a σ-algebra [math]\displaystyle{ \Sigma }[/math] if the above equation holds for all [math]\displaystyle{ R }[/math] in [math]\displaystyle{ \sigma(X) }[/math] and [math]\displaystyle{ B }[/math] in [math]\displaystyle{ \sigma(Y) }[/math].

Two random variables [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are conditionally independent given a random variable [math]\displaystyle{ W }[/math] if they are independent given σ(W): the σ-algebra generated by [math]\displaystyle{ W }[/math]. This is commonly written:

[math]\displaystyle{ X \perp\!\!\!\perp Y \mid W }[/math] or
[math]\displaystyle{ X \perp Y \mid W }[/math]

This it read "[math]\displaystyle{ X }[/math] is independent of [math]\displaystyle{ Y }[/math], given [math]\displaystyle{ W }[/math]"; the conditioning applies to the whole statement: "([math]\displaystyle{ X }[/math] is independent of [math]\displaystyle{ Y }[/math]) given [math]\displaystyle{ W }[/math]".

[math]\displaystyle{ (X \perp\!\!\!\perp Y) \mid W }[/math]

This notation extends [math]\displaystyle{ X \perp\!\!\!\perp Y }[/math] for "[math]\displaystyle{ X }[/math] is independent of [math]\displaystyle{ Y }[/math]."

If [math]\displaystyle{ W }[/math] assumes a countable set of values, this is equivalent to the conditional independence of X and Y for the events of the form [math]\displaystyle{ [W=w] }[/math]. Conditional independence of more than two events, or of more than two random variables, is defined analogously.

The following two examples show that [math]\displaystyle{ X \perp\!\!\!\perp Y }[/math] neither implies nor is implied by [math]\displaystyle{ (X \perp\!\!\!\perp Y) \mid W }[/math].

First, suppose [math]\displaystyle{ W }[/math] is 0 with probability 0.5 and 1 otherwise. When W = 0 take [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] to be independent, each having the value 0 with probability 0.99 and the value 1 otherwise. When [math]\displaystyle{ W=1 }[/math], [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are again independent, but this time they take the value 1 with probability 0.99. Then [math]\displaystyle{ (X \perp\!\!\!\perp Y) \mid W }[/math]. But [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] are dependent, because Pr(X = 0) < Pr(X = 0|Y = 0). This is because Pr(X = 0) = 0.5, but if Y = 0 then it's very likely that W = 0 and thus that X = 0 as well, so Pr(X = 0|Y = 0) > 0.5.

For the second example, suppose [math]\displaystyle{ X \perp\!\!\!\perp Y }[/math], each taking the values 0 and 1 with probability 0.5. Let [math]\displaystyle{ W }[/math] be the product [math]\displaystyle{ X \cdot Y }[/math]. Then when [math]\displaystyle{ W=0 }[/math], Pr(X = 0) = 2/3, but Pr(X = 0|Y = 0) = 1/2, so [math]\displaystyle{ (X \perp\!\!\!\perp Y) \mid W }[/math] is false. This is also an example of Explaining Away. See Kevin Murphy's tutorial [3] where [math]\displaystyle{ X }[/math] and [math]\displaystyle{ Y }[/math] take the values "brainy" and "sporty".

Conditional independence of random vectors

Two random vectors [math]\displaystyle{ \mathbf{X}=(X_1,\ldots,X_l)^{\mathrm T} }[/math] and [math]\displaystyle{ \mathbf{Y}=(Y_1,\ldots,Y_m)^{\mathrm T} }[/math] are conditionally independent given a third random vector [math]\displaystyle{ \mathbf{Z}=(Z_1,\ldots,Z_n)^{\mathrm T} }[/math] if and only if they are independent in their conditional cumulative distribution given [math]\displaystyle{ \mathbf{Z} }[/math]. Formally:

[math]\displaystyle{ (\mathbf{X} \perp\!\!\!\perp \mathbf{Y}) \mid \mathbf{Z} \quad \iff \quad F_{\mathbf{X},\mathbf{Y}|\mathbf{Z}=\mathbf{z}}(\mathbf{x},\mathbf{y}) = F_{\mathbf{X}\,\mid\,\mathbf{Z}\,=\,\mathbf{z}}(\mathbf{x}) \cdot F_{\mathbf{Y}\,\mid\,\mathbf{Z}\,=\,\mathbf{z}}(\mathbf{y}) \quad \text{for all } \mathbf{x},\mathbf{y},\mathbf{z} }[/math]






where [math]\displaystyle{ \mathbf{x}=(x_1,\ldots,x_l)^{\mathrm T} }[/math], [math]\displaystyle{ \mathbf{y}=(y_1,\ldots,y_m)^{\mathrm T} }[/math] and [math]\displaystyle{ \mathbf{z}=(z_1,\ldots,z_n)^{\mathrm T} }[/math] and the conditional cumulative distributions are defined as follows.

[math]\displaystyle{ \begin{align} F_{\mathbf{X},\mathbf{Y}\,\mid\,\mathbf{Z}\,=\,\mathbf{z}}(\mathbf{x},\mathbf{y}) &= \Pr(X_1 \leq x_1,\ldots,X_l \leq x_l, Y_1 \leq y_1,\ldots,Y_m \leq y_m \mid Z_1=z_1,\ldots,Z_n=z_n) \\[6pt] F_{\mathbf{X}\,\mid\,\mathbf{Z}\,=\,\mathbf{z}}(\mathbf{x}) &= \Pr(X_1 \leq x_1,\ldots,X_l \leq x_l \mid Z_1=z_1,\ldots,Z_n=z_n) \\[6pt] F_{\mathbf{Y}\,\mid\,\mathbf{Z}\,=\,\mathbf{z}}(\mathbf{y}) &= \Pr(Y_1 \leq y_1,\ldots,Y_m \leq y_m \mid Z_1=z_1,\ldots,Z_n=z_n) \end{align} }[/math]

Uses in Bayesian inference

Let p be the proportion of voters who will vote "yes" in an upcoming referendum. In taking an opinion poll, one chooses n voters randomly from the population. For i = 1, ..., n, let Xi = 1 or 0 corresponding, respectively, to whether or not the ith chosen voter will or will not vote "yes".

In a frequentist approach to statistical inference one would not attribute any probability distribution to p (unless the probabilities could be somehow interpreted as relative frequencies of occurrence of some event or as proportions of some population) and one would say that X1, ..., Xn are independent random variables.

By contrast, in a Bayesian approach to statistical inference, one would assign a probability distribution to p regardless of the non-existence of any such "frequency" interpretation, and one would construe the probabilities as degrees of belief that p is in any interval to which a probability is assigned. In that model, the random variables X1, ..., Xn are not independent, but they are conditionally independent given the value of p. In particular, if a large number of the Xs are observed to be equal to 1, that would imply a high conditional probability, given that observation, that p is near 1, and thus a high conditional probability, given that observation, that the next X to be observed will be equal to 1.

Rules of conditional independence

A set of rules governing statements of conditional independence have been derived from the basic definition.[4][5]

These rules were termed "Graphoid Axioms" by Pearl and Paz,[6] because they hold in graphs, where [math]\displaystyle{ X \perp\!\!\!\perp A\mid B }[/math] is interpreted to mean: "All paths from X to A are intercepted by the set B".[7]


[math]\displaystyle{ X \perp\!\!\!\perp Y \quad \Rightarrow \quad Y \perp\!\!\!\perp X }[/math]


[math]\displaystyle{ X \perp\!\!\!\perp A,B \quad \Rightarrow \quad \text{ and } \begin{cases} X \perp\!\!\!\perp A \\ X \perp\!\!\!\perp B \end{cases} }[/math]


  • [math]\displaystyle{ p_{X,A,B}(x,a,b) = p_X(x) p_{A,B}(a,b) }[/math]      (meaning of [math]\displaystyle{ X \perp\!\!\!\perp A,B }[/math])
  • [math]\displaystyle{ \int_B p_{X,A,B}(x,a,b)\,db = \int_B p_X(x) p_{A,B}(a,b)\,db }[/math]      (ignore variable B by integrating it out)
  • [math]\displaystyle{ p_{X,A}(x,a) = p_X(x) p_A(a) }[/math]     

A similar proof shows the independence of X and B.

Weak union

[math]\displaystyle{ X \perp\!\!\!\perp A,B \quad \Rightarrow \quad \text{ and } \begin{cases} X \perp\!\!\!\perp A \mid B\\ X \perp\!\!\!\perp B \mid A \end{cases} }[/math]


  • By assumption, [math]\displaystyle{ \Pr(X) = \Pr(X \mid A, B) }[/math].
  • Due to the property of decomposition [math]\displaystyle{ X \perp\!\!\!\perp B }[/math], [math]\displaystyle{ \Pr(X) = \Pr(X \mid B) }[/math].
  • Combining the above two equalities gives [math]\displaystyle{ \Pr(X \mid B) = \Pr(X \mid A, B) }[/math], which establishes [math]\displaystyle{ X \perp\!\!\!\perp A \mid B }[/math].

The second condition can be proved similarly.


[math]\displaystyle{ \left.\begin{align} X \perp\!\!\!\perp A \mid B \\ X \perp\!\!\!\perp B \end{align}\right\}\text{ and } \quad \Rightarrow \quad X \perp\!\!\!\perp A,B }[/math]


This property can be proved by noticing [math]\displaystyle{ \Pr(X\mid A,B) = \Pr(X\mid B) = \Pr(X) }[/math], each equality of which is asserted by [math]\displaystyle{ X \perp\!\!\!\perp A \mid B }[/math] and [math]\displaystyle{ X \perp\!\!\!\perp B }[/math], respectively.


For strictly positive probability distributions,[5] the following also holds:

[math]\displaystyle{ \left.\begin{align} X \perp\!\!\!\perp Y \mid Z, W\\ X \perp\!\!\!\perp W \mid Z, Y \end{align}\right\}\text{ and } \quad \Rightarrow \quad X \perp\!\!\!\perp W, Y \mid Z }[/math]


By assumption:

[math]\displaystyle{ P(X|Z, W, Y) = P(X|Z, W) \land P(X|Z, W, Y) = P(X|Z, Y) \implies P(X|Z, Y) = P(X|Z, W) }[/math]

Using this equality, together with the Law of total probability applied to [math]\displaystyle{ P(X|Z) }[/math]:

[math]\displaystyle{ \begin{align} P(X|Z) &= \sum_{w \in W} P(X|Z, W=w)P(W=w|Z) \\[4pt] &= \sum_{w \in W} P(X|Y, Z)P(W=w|Z) \\[4pt] &= P(X|Z, Y) \sum_{w \in W} P(W=w|Z) \\[4pt] &= P(X|Z, Y) \end{align} }[/math]

Since [math]\displaystyle{ P(X|Z, W, Y) = P(X|Z, Y) }[/math] and [math]\displaystyle{ P(X|Z, Y) = P(X|Z) }[/math], it follows that [math]\displaystyle{ P(X|Z, W, Y) = P(X|Z) \iff X \perp\!\!\!\perp Y,W | Z }[/math].

Technical note: since these implications hold for any probability space, they will still hold if one considers a sub-universe by conditioning everything on another variable, say K. For example, [math]\displaystyle{ X \perp\!\!\!\perp Y \Rightarrow Y \perp\!\!\!\perp X }[/math] would also mean that [math]\displaystyle{ X \perp\!\!\!\perp Y \mid K \Rightarrow Y \perp\!\!\!\perp X \mid K }[/math].

See also


  1. To see that this is the case, one needs to realise that Pr(RB | Y) is the probability of an overlap of R and B (the purple shaded area) in the Y area. Since, in the picture on the left, there are two squares where R and B overlap within the Y area, and the Y area has twelve squares, Pr(RB | Y) = 2/12 = 1/6. Similarly, Pr(R | Y) = 4/12 = 1/3 and Pr(B | Y) = 6/12 = 1/2.
  2. 2.0 2.1 Could someone explain conditional independence?
  3. "Graphical Models". 
  4. "Conditional Independence in Statistical Theory". Journal of the Royal Statistical Society, Series B 41 (1): 1–31. 1979. 
  5. 5.0 5.1 J Pearl, Causality: Models, Reasoning, and Inference, 2000, Cambridge University Press
  6. Pearl, Judea; Paz, Azaria (1985). "Graphoids: A Graph-Based Logic for Reasoning About Relevance Relations". 
  7. Pearl, Judea (1988). Probabilistic reasoning in intelligent systems: networks of plausible inference. Morgan Kaufmann. ISBN 9780934613736. 

External links