Conditioning (probability)

| Main Article
| Discussion
| Related Articles  [?]
| Bibliography  [?]
| External Links  [?]
| Citable Version  [?]

|
|
|
|
|
|
|
|

This editable Main Article is under development and subject to a disclaimer.

[edit intro]

Beliefs depend on the available information. This idea is formalized in probability theory by conditioning. Conditional probabilities, conditional expectations and conditional distributions are treated on three levels: discrete probabilities, probability density functions, and measure theory. Conditioning leads to a non-random result if the condition is completely specified; otherwise, if the condition is left random, the result of conditioning is also random.

This article concentrates on interrelations between various kinds of conditioning, shown mostly by examples.

## Contents

* 1 Conditioning on the discrete level
* 1.1 Conditional probability
* 1.2 Conditional expectation
* 1.3 Conditional distribution
* 2 Conditioning on the level of densities
* 2.1 Conditional probability
* 2.1.1 Calculation
* 2.1.2 Interpretation
* 2.2 Conditional expectation
* 2.3 Conditional distribution
* 3 What conditioning is not
* 3.1 Geometric intuition: caution
* 3.2 The limiting procedure
* 4 Conditioning on the level of measure theory
* 4.1 Geometric intuition: caution
* 4.2 Conditional probability
* 4.3 Conditional expectation
* 4.4 Conditional distribution
* 5 Notes
* 6 References

## Conditioning on the discrete level[edit]

Example. A fair coin is tossed 10 times; the random variable X is the number of heads in these 10 tosses, and Y — the number of heads in the first 3 tosses. In spite of the fact that Y emerges before X it may happen that someone knows X but not Y.

### Conditional probability[edit]

Given that X=1, the conditional probability of the event Y=0 is P(Y=0|X=1)=P(Y=0,X=1)/P(X=1)=0.7. More generally,

ℙ(Y=0|X=x)=(7x)(10x)=7!(10−x)!(7−x)!10!

for x=0,1,2,3,4,5,6,7; otherwise (for x=8,9,10), P(Y=0|X=x)=0. One may also treat the conditional probability as a random variable, — a function of the random variable X, namely,

ℙ(Y=0|X)={(7X)/(10X)for X≤7,0for X>7.

The expectation of this random variable is equal to the (unconditional) probability,

𝔼(ℙ(Y=0|X))=∑xℙ(Y=0|X=x)ℙ(X=x)=ℙ(Y=0),

namely,

∑x=07(7x)(10x)⋅1210(10x)=18,

which is an instance of the law of total probability E(P(A|X))=P(A).

Thus, P(Y=0|X=1) may be treated as the value of the random variable P(Y=0|X) corresponding to X=1. On the other hand, P(Y=0|X=1) is well-defined irrespective of other possible values of X.

### Conditional expectation[edit]

Given that X=1, the conditional expectation of the random variable Y is E(Y|X=1)=0.3. More generally,

𝔼(Y|X=x)=310x

for x=0,...,10. (In this example it appears to be a linear function, but in general it is nonlinear.) One may also treat the conditional expectation as a random variable, — a function of the random variable X, namely,

𝔼(Y|X)=310X.

The expectation of this random variable is equal to the (unconditional) expectation of Y,

𝔼(𝔼(Y|X))=∑x𝔼(Y|X=x)ℙ(X=x)=𝔼(Y),

namely,

∑x=010310x⋅1210(10x)=32, or simply  𝔼(310X)=310𝔼(X)=310⋅5=32,

which is an instance of the law of total expectation E(E(Y|X))=E(Y).

The random variable E(Y|X) is the best predictor of Y given X. That is, it minimizes the mean square error E(Y−f(X))2 on the class of all random variables of the form f(X). This class of random variables remains intact if X is replaced, say, with 2X. Thus, E(Y|2X)=E(Y|X). It does not mean that E(Y|2X)=0.3⋅2X; rather, E(Y|2X)=0.15⋅2X=0.3X. In particular, E(Y|2X=2)=0.3. More generally, E(Y|g(X))=E(Y|X) for every function g that is one-to-one on the set of all possible values of X. The values of X are irrelevant; what matters is the partition (denote it αX)

Ω={X=x1}⊎{X=x2}⊎…

of the sample space Ω into disjoint sets {X=xn}. (Here x1,x2,… are all possible values of X.) Given an arbitrary partition α of Ω, one may define the random variable E(Y|α). Still, E(E(Y|α))=E(Y).

Conditional probability may be treated as a special case of conditional expectation. Namely, P(A|X)=E(Y|X) if Y is the indicator of A. Therefore the conditional probability also depends on the partition αX generated by X rather than on X itself; P(A|g(X))=P(A|X)=P(A|α), α=αX=αg(X).

On the other hand, conditioning on an event B is well-defined, provided that P(B)≠0, irrespective of any partition that may contain B as one of several parts.

### Conditional distribution[edit]

Given X=x, the conditional distribution of Y is

ℙ(Y=y|X=x)=(3y)(7x−y)(10x)=(xy)(10−x3−y)(103)

for 0≤y≤min(3,x). It is the hypergeometric distribution H(x;3,7), or equivalently, H(3;x,10−x). The corresponding expectation 0.3x, obtained from the general formula nRR+W for H(n;R,W), is nothing but the conditional expectation E(Y|X=x)=0.3x.

Treating H(X;3,7) as a random distribution (a random vector in the four-dimensional space of all measures on {0,1,2,3}), one may take its expectation, getting the unconditional distribution of Y, — the binomial distribution Bin(3,0.5). This fact amounts to the equality

∑x=010ℙ(Y=y|X=x)ℙ(X=x)=ℙ(Y=y)=123(3y)

for y=0,1,2,3; just the law of total probability.

## Conditioning on the level of densities[edit]

Example. A point of the sphere x2+y2+z2=1 is chosen at random according to the uniform distribution on the sphere. The random variables X, Y, Z are the coordinates of the random point. The joint density of X, Y, Z does not exist (since the sphere is of zero volume), but the joint density fX,Y of X, Y exists,

fX,Y(x,y)={12π1−x2−y2if x2+y2<1,0otherwise.

(The density is non-constant because of a non-constant angle between the sphere and the plane.) The density of X may be calculated by integration,

fX(x)=∫−∞+∞fX,Y(x,y)dy=∫−1−x2+1−x2dy2π1−x2−y2;

surprisingly, the result does not depend on x in (-1,1),

fX(x)={0.5for −1<x<1,0otherwise,

which means that X is distributed uniformly on (−1,1). The same holds for Y and Z (and in fact, for aX+bY+cZ whenever a2+b2+c2=1).

### Conditional probability[edit]

#### Calculation[edit]

Given that X=0.5, the conditional probability of the event Y≤0.75 is the integral of the conditional density,

fY|X=0.5(y)=fX,Y(0.5,y)fX(0.5)={1π0.75−y2for −0.75<y<0.75,0otherwise;ℙ(Y≤0.75|X=0.5)=∫−∞0.75fY|X=0.5(y)dy==∫−0.750.75dyπ0.75−y2=12+1πarcsin⁡0.75=56.

More generally,

ℙ(Y≤y|X=x)=12+1πarcsin⁡y1−x2

for all x and y such that −1<x<1 (otherwise the denominator fX(x) vanishes) and −1−x2<y<1−x2 (otherwise the conditional probability degenerates to 0 or 1). One may also treat the conditional probability as a random variable, — a function of the random variable X, namely,

ℙ(Y≤y|X)={0for X2≥1−y2 and y<0,12+1πarcsin⁡y1−X2for X2<1−y2,1for X2≥1−y2 and y>0.

The expectation of this random variable is equal to the (unconditional) probability,

𝔼(ℙ(Y≤y|X))=∫−∞+∞ℙ(Y≤y|X=x)fX(x)dx=ℙ(Y≤y),

which is an instance of the law of total probability E(P(A|X))=P(A).

#### Interpretation[edit]

The conditional probability P(Y≤0.75|X=0.5) cannot be interpreted as P(Y≤0.75,X=0.5)/P(X=0.5), since the latter gives 0/0. Accordingly, P(Y≤0.75|X=0.5) cannot be interpreted via empirical frequencies, since the exact value X=0.5 has no chance to appear at random, not even once during an infinite sequence of independent trials.

The conditional probability can be interpreted as a limit,

ℙ(Y≤0.75|X=0.5)=limε->0+ℙ(Y≤0.75|0.5−ε<X<0.5+ε)==limε->0+ℙ(Y≤0.75,0.5−ε<X<0.5+ε)ℙ(0.5−ε<X<0.5+ε)==limε->0+∫0.5−ε0.5+εdx∫−∞0.75dyfX,Y(x,y)∫0.5−ε0.5+εdxfX(x).

### Conditional expectation[edit]

The conditional expectation E(Y|X=0.5) is of little interest; it vanishes just by symmetry. It is more interesting to calculate E(|Z||X=0.5) treating |Z| as a function of X, Y:

|Z|=h(X,Y)=1−X2−Y2;E(|Z||X=0.5)=∫−∞+∞h(0.5,y)fY|X=0.5(y)dy==∫−0.75+0.750.75−y2⋅dyπ0.75−y2=2π0.75.

More generally,

𝔼(|Z||X=x)=2π1−x2

for −1<x<1. One may also treat the conditional expectation as a random variable, — a function of the random variable X, namely,

𝔼(|Z||X)=2π1−X2.

The expectation of this random variable is equal to the (unconditional) expectation of |Z|,

𝔼(𝔼(|Z||X))=∫−∞+∞𝔼(|Z||X=x)fX(x)dx=𝔼(|Z|),

namely,

∫−1+12π1−x2⋅dx2=12,

which is an instance of the law of total expectation E(E(Y|X))=E(Y).

The random variable E(|Z||X) is the best predictor of |Z| given X. That is, it minimizes the mean square error E(|Z|−f(X))2 on the class of all random variables of the form f(X). Similarly to the discrete case, E(|Z||g(X))=E(|Z||X) for every measurable function g that is one-to-one on (−1,1).

### Conditional distribution[edit]

Given X=x, the conditional distribution of Y, given by the density fY|X=x(y), is the (rescaled) arcsin distribution; its cumulative distribution function is

FY|X=x(y)=ℙ(Y≤y|X=x)=12+1πarcsin⁡y1−x2

for all x and y such that x2+y2<1. The corresponding expectation of h(x,Y) is nothing but the conditional expectation E(h(X,Y)|X=x). The mixture of these conditional distributions, taken for all x (according to the distribution of X) is the unconditional distribution of Y. This fact amounts to the equalities

∫−∞+∞fY|X=x(y)fX(x)dx=fY(y),∫−∞+∞FY|X=x(y)fX(x)dx=FY(y),

the latter being the instance of the law of total probability mentioned above.

## What conditioning is not[edit]

On the discrete level conditioning is possible only if the condition is of nonzero probability (one cannot divide by zero). On the level of densities, conditioning on X=x is possible even though P(X=x)=0. This success may create the illusion that conditioning is always possible. Regretfully, it is not, for several reasons presented below.

### Geometric intuition: caution[edit]

The result P(Y≤0.75|X=0.5)=5/6, mentioned above, is geometrically evident in the following sense. The points (x,y,z) of the sphere x2+y2+z2=1, satisfying the condition x=0.5, are a circle y2+z2=0.75 of radius 0.75 on the plane x=0.5. The inequality y≤0.75 holds on an arc. The length of the arc is 5/6 of the length of the circle, which is why the conditional probability is equal to 5/6.

This successful geometric explanation may create the illusion that the following question is trivial.

A point of a given sphere is chosen at random (uniformly). Given that the point lies on a given plane, what is its conditional distribution?

It may seem evident that the conditional distribution must be uniform on the given circle (the intersection of the given sphere and the given plane). Sometimes it really is, but in general it is not. Especially, Z is distributed uniformly on (−1,+1) and independent of the ratio Y/X, thus, P(Z≤0.5|Y/X)=0.75. On the other hand, the inequality z≤0.5 holds on an arc of the circle x2+y2+z2=1, y=cx (for any given c). The length of the arc is 2/3 of the length of the circle. However, the conditional probability is 3/4, not 2/3. This is a manifestation of the classical Borel paradox[1] [2].

"Appeals to symmetry can be misleading if not formalized as invariance arguments." Pollard[3]

Another example. A random rotation of the three-dimensional space is a rotation by a random angle around a random axis. Geometric intuition suggests that the angle is independent of the axis and distributed uniformly. However, the latter is wrong; small values of the angle are less probable.

### The limiting procedure[edit]

Given an event B of zero probability, the formula ℙ(A|B)=ℙ(A∩B)/ℙ(B) is useless, however, one can try ℙ(A|B)=limn->∞ℙ(A∩Bn)/ℙ(Bn) for an appropriate sequence of events Bn of nonzero probability such that Bn↓B (that is, B1⊃B2⊃… and B1∩B2∩…=B). One example is given above. Two more examples are Brownian bridge and Brownian excursion.

In the latter two examples the law of total probability is irrelevant, since only a single event (the condition) is given. In contrast, in the example above the law of total probability applies, since the event X=0.5 is included into a family of events X=x where x runs over (−1,1), and these events are a partition of the probability space.

In order to avoid paradoxes (such as the Borel's paradox), the following important distinction should be taken into account. If a given event is of nonzero probability then conditioning on it is well-defined (irrespective of any other events), as was noted above. In contrast, if the given event is of zero probability then conditioning on it is ill-defined unless some additional input is provided. Wrong choice of this additional input leads to wrong conditional probabilities (expectations, distributions). In this sense, "the concept of a conditional probability with regard to an isolated hypothesis whose probability equals 0 is inadmissible." (Kolmogorov; quoted in [3]).

The additional input may be (a) a symmetry (invariance group); (b) a sequence of events Bn such that Bn↓B, P(Bn)>0; (c) a partition containing the given event. Measure-theoretic conditioning (below) investigates Case (c), discloses its relation to (b) in general and to (a) when applicable.

Some events of zero probability are beyond the reach of conditioning. An example: let Xn be independent random variables distributed uniformly on (0,1), and B the event "Xn->0 as n->∞"; what about P(Xn<0.5|B)? Does it tend to 1, or not? Another example: let X be a random variable distributed uniformly on (0,1), and B the event "X is a rational number"; what about P(X=1/n|B)? The only answer is that, once again, "the concept of a conditional probability with regard to an isolated hypothesis whose probability equals 0 is inadmissible." (Kolmogorov, quoted in [3]).

## Conditioning on the level of measure theory[edit]

Example. Let Y be a random variable distributed uniformly on (0,1), and X=f(Y) where f is a given function. Two cases are treated below: f=f1 and f=f2, where f1 is the continuous piecewise-linear function

f1(y)={3yfor 0≤y≤1/3,1.5(1−y)for 1/3≤y≤2/3,0.5for 2/3≤y≤1,

and f2 is the everywhere continuous but nowhere differentiable Weierstrass function.

### Geometric intuition: caution[edit]

In the case f=f1, given X=0.75, two values of Y are possible, 0.25 and 0.5. It may seem evident that both values are of conditional probability 0.5 just because one point is congruent to another point. However, this is an illusion; see below.

### Conditional probability[edit]

The conditional probability P(Y≤1/3|X) may be defined as the best predictor of the indicator

I={1if Y≤1/3,0otherwise,

given X. That is, it minimizes the mean square error E(I−g(X))2 on the class of all random variables of the form g(X).

In the case f=f1 the corresponding function g=g1 may be calculated explicitly,[4]

g1(x)={1for 0<x<0.5,0for x=0.5,1/3for 0.5<x<1.

Alternatively, the limiting procedure may be used,

g1(x)=limε->0+ℙ(Y≤1/3|x−ε≤X≤x+ε),

giving the same result.

Thus, P(Y≤1/3|X)=g1(X). The expectation of this random variable is equal to the (unconditional) probability, E(P(Y≤1/3|X))=P(Y≤1/3), namely,

1⋅ℙ(X<0.5)+0⋅ℙ(X=0.5)+13⋅ℙ(X>0.5)=1⋅16+0⋅13+13⋅(16+13)=13,

which is an instance of the law of total probability E(P(A|X))=P(A).

In the case f=f2 the corresponding function g=g2 probably cannot be calculated explicitly. Nevertheless it exists, and can be computed numerically. Indeed, the space L2(Ω) of all square integrable random variables is a Hilbert space; the indicator I is a vector of this space; and random variables of the form g(X) are a (closed, linear) subspace. The orthogonal projection of this vector to this subspace is well-defined. It can be computed numerically, using finite-dimensional approximations to the infinite-dimensional Hilbert space.

Once again, the expectation of the random variable P(Y≤1/3|X)=g2(X) is equal to the (unconditional) probability, E(P(Y≤1/3|X))=P(Y≤1/3), namely,

∫01g2(f2(y))dy=13.

However, the Hilbert space approach treats g2 as an equivalence class of functions rather than an individual function. Measurability of g2 is ensured, but continuity (or even Riemann integrability) is not. The value g2(0.5) is determined uniquely, since the point 0.5 is an atom of the distribution of X. Other values x are not atoms, thus, corresponding values g2(x) are not determined uniquely. Once again, "the concept of a conditional probability with regard to an isolated hypothesis whose probability equals 0 is inadmissible." (Kolmogorov, quoted in [3]).

Alternatively, the same function g (be it g1 or g2) may be defined as the Radon-Nikodym derivative

g=dνdμ,

where measures μ, ν are defined by

μ(B)=ℙ(X∈B),ν(B)=ℙ(X∈B,Y≤1/3)

for all Borel sets B⊂ℝ. That is, μ is the (unconditional) distribution of X, while ν is one third of its conditional distribution,

ν(B)=ℙ(X∈B|Y≤1/3)ℙ(Y≤1/3)=13ℙ(X∈B|Y≤1/3).

Both approaches (via the Hilbert space, and via the Radon-Nikodym derivative) treat g as an equivalence class of functions; two functions g and g′ are treated as equivalent, if g(X)=g′(X) almost surely. Accordingly, the conditional probability P(Y≤1/3|X) is treated as an equivalence class of random variables; as usual, two random variables are treated as equivalent if they are equal almost surely.

### Conditional expectation[edit]

The conditional expectation E(Y|X) may be defined as the best predictor of Y given X. That is, it minimizes the mean square error E(Y−h(X))2 on the class of all random variables of the form h(X).

In the case f=f1 the corresponding function h=h1 may be calculated explicitly,[5]

h1(x)={x/3for 0<x<0.5,5/6for x=0.5,(2−x)/3for 0.5<x<1.

Alternatively, the limiting procedure may be used,

h1(x)=limε->0+𝔼(Y|x−ε≤X≤x+ε),

giving the same result.

Thus, E(Y|X)=h1(X). The expectation of this random variable is equal to the (unconditional) expectation, E(E(Y|X))=E(Y), namely,

∫01h1(f1(y))dy=∫01/63y3dy++∫1/61/32−3y3dy+∫1/32/32−1.5(1−y)3dy+∫2/3156dy=12,

which is an instance of the law of total expectation E(E(Y|X))=E(Y).

In the case f=f2 the corresponding function h=h2 probably cannot be calculated explicitly. Nevertheless it exists, and can be computed numerically in the same way as g2 above, — as the orthogonal projection in the Hilbert space. The law of total expectation holds, since the projection cannot change the scalar product by the constant function 1 belonging to the subspace.

Alternatively, the same function h (be it h1 or h2) may be defined as the Radon-Nikodym derivative

h=dνdμ,

where measures μ,ν are defined by

μ(B)=ℙ(X∈B),ν(B)=𝔼(Y,X∈B)

for all Borel sets B⊂ℝ. Here E(Y;A) is the restricted expectation, not to be confused with the conditional expectation E(Y|A)=E(Y;A)/P(A).

### Conditional distribution[edit]

In the case f=f1 the conditional cumulative distribution function may be calculated explicitly, similarly to g1. The limiting procedure gives

FY|X=0.75(y)=ℙ(Y≤y|X=0.75)==limε->0+ℙ(Y≤y|0.75−ε≤X≤0.75+ε)=={0for −∞<y<1/4,1/6for y=1/4,1/3for 1/4<y<1/2,2/3for y=1/2,1for 1/2<y<∞,

which cannot be correct, since a cumulative distribution function must be right-continuous!

This paradoxical result is explained by measure theory as follows. For a given y the corresponding FY|X=x(y)=P(Y≤y|X=x) is well-defined (via the Hilbert space or the Radon-Nikodym derivative) as an equivalence class of functions (of x). Treated as a function of y for a given x it is ill-defined unless some additional input is provided. Namely, a function (of x) must be chosen within every (or at least almost every) equivalence class. Wrong choice leads to wrong conditional cumulative distribution functions.

A right choice can be made as follows. First, FY|X=x(y)=P(Y≤y|X=x) is considered for rational numbers y only. (Any other dense countable set may be used equally well.) Thus, only a countable set of equivalence classes is used; all choices of functions within these classes are mutually equivalent, and the corresponding function of rational y is well-defined (for almost every x). Second, the function is extended from rational numbers to real numbers by right continuity.

In general the conditional distribution is defined for almost all x (according to the distribution of X), but sometimes the result is continuous in x, in which case individual values are acceptable. In the considered example this is the case; the correct result for x=0.75,

FY|X=0.75(y)=ℙ(Y≤y|X=0.75)=={0for −∞<y<1/4,1/3for 1/4≤y<1/2,1for 1/2≤y<∞

shows that the conditional distribution of Y given X=0.75 consists of two atoms, at 0.25 and 0.5, of probabilities 1/3 and 2/3 respectively.

Similarly, the conditional distribution may be calculated for all x in (0,0.5) or (0.5,1).

The value x=0.5 is an atom of the distribution of X, thus, the corresponding conditional distribution is well-defined and may be calculated by elementary means (the denominator does not vanish); the conditional distribution of Y given X=0.5 is uniform on (2/3,1). Measure theory leads to the same result.

The mixture of all conditional distributions is the (unconditional) distribution of Y.

The conditional expectation E(Y|X=x) is nothing but the expectation with respect to the conditional distribution.

In the case f=f2 the corresponding FY|X=x(y)=P(Y≤y|X=x) probably cannot be calculated explicitly. For a given y it is well-defined (via the Hilbert space or the Radon-Nikodym derivative) as an equivalence class of functions (of x). The right choice of functions within these equivalence classes may be made as above; it leads to correct conditional cumulative distribution functions, thus, conditional distributions. In general, conditional distributions need not be atomic or absolutely continuous (nor mixtures of both types). Probably, in the considered example they are singular (like the Cantor distribution).

Once again, the mixture of all conditional distributions is the (unconditional) distribution, and the conditional expectation is the expectation with respect to the conditional distribution.

## Notes[edit]

1. ↑ Pollard 2002, Sect. 5.5, Example 17 on page 122
2. ↑ Durrett 1996, Sect. 4.1(a), Example 1.6 on page 224
3. ↑ 3.0 3.1 3.2 3.3 Pollard 2002, Sect. 5.5, page 122
4. ↑ Proof:

𝔼(I−g(X))2==∫01/3(1−g(3y))2dy+∫1/32/3g2(1.5(1−y))dy+∫2/31g2(0.5)dy==∫01(1−g(x))2dx3+∫0.51g2(x)dx1.5+13g2(0.5)==13∫00.5(1−g(x))2dx+13g2(0.5)+13∫0.51((1−g(x))2+2g2(x))dx;
it remains to note that (1−a)2+2a2 is minimal at a=1/3.
5. ↑ Proof: 𝔼(Y−h1(X))2=∫01(y−h1(f1(x)))2dy=∫01/3(y−h1(3y))2dy+∫1/32/3(y−h1(1.5(1−y)))2dy+∫2/31(y−h1(0.5))2dy=∫01(x3−h1(x))2dx3+∫0.51(1−x1.5−h1(x))2dx1.5+13h12(0.5)−59h1(0.5)+1981=13∫00.5(h1(x)−x3)2dx+13h12(0.5)−59h1(0.5)+1981+13∫0.51((h1(x)−x3)2+2(h1(x)−1+2x3)2)dx; it remains to note that (a−x3)2+2(a−1+2x3)2 is minimal at a=2−x3, and 13a2−59a is minimal at a=56.

## References[edit]

* Durrett, Richard (1996), Probability: theory and examples (Second ed.)
* Pollard, David (2002), A user's guide to measure theoretic probability, Cambridge University Press