Conditional Distributions

The distribution of one random variable after the value of another is known.

Draft — not yet reviewed by the site owner.

Prerequisites: Joint and Marginal Distributions, Conditional Probability.

A conditional distribution describes what remains uncertain about one random variable after we learn something about another. Knowing a train’s departure time, for example, may change the range of possible arrival times. The conditional distribution describes that changed range and the probabilities within it.

A slice of a joint distribution

For discrete variables, conditioning is ordinary conditional probability: keep the cells of a joint table where X=xX=x, then divide by the probability of that row or column. Provided P(X=x)>0P(X=x)>0,

pY∣X=x(y)=pX,Y(x,y)pX(x).p_{Y\mid X=x}(y)=\frac{p_{X,Y}(x,y)}{p_X(x)}.

For continuous variables, P(X=x)=0P(X=x)=0, so we cannot literally divide by that event’s probability. Instead, a joint density gives a density slice at X=xX=x. Dividing by the marginal density makes the slice integrate to 1:

fY∣X=x(y)=fX,Y(x,y)fX(x),fX(x)>0.f_{Y\mid X=x}(y)=\frac{f_{X,Y}(x,y)}{f_X(x)},\qquad f_X(x)>0.

The formula describes a conditional density for almost every relevant xx. It does not assign positive probability to the exact event X=xX=x; it describes how the distribution of YY changes as we learn XX. Always state the allowed values of yy, which may depend on xx.

The joint density is supported on a triangle where y lies between zero and x. At x equals three quarters, the highlighted vertical slice has possible y values only from zero to three quarters.
A model joint density equal to 2 on 0 < y < x < 1. Fixing x = 0.75 leaves a vertical slice with 0 < y < 0.75. Divide its constant height 2 by f_X(0.75) = 1.5 to make the conditional density integrate to 1.

Worked example: knowing the upper limit

Use the joint density fX,Y(x,y)=2f_{X,Y}(x,y)=2 on the triangle 0<y<x<10<y<x<1 from joint and marginal distributions. Its marginal density is fX(x)=2xf_X(x)=2x for 0<x<10<x<1. Once X=xX=x is known,

fY∣X=x(y)=22x=1x,0<y<x.f_{Y\mid X=x}(y)=\frac{2}{2x}=\frac{1}{x},\qquad 0<y<x.

This is a uniform distribution from 0 to xx. If X=0.75X=0.75, the conditional density is 4/34/3 between 0 and 0.75. The height exceeds 1, but its area is (4/3)(0.75)=1(4/3)(0.75)=1.

For example, with X=0.75X=0.75, the probability that Y<0.25Y<0.25 is the fraction of the remaining interval below 0.25:

P(Y<0.25∣X=0.75)=0.250.75=13.P(Y<0.25\mid X=0.75)=\frac{0.25}{0.75}=\frac13.

From a conditional back to a joint

The same relationship works in reverse: fX,Y(x,y)=fY∣X=x(y)fX(x)f_{X,Y}(x,y)=f_{Y\mid X=x}(y)f_X(x). This is the continuous version of the multiplication rule. If we know how XX is generated and then how YY is generated given XX, we can build their joint distribution.

To forget XX again, average the conditional densities over its possible values:

fY(y)=∫−∞∞fY∣X=x(y)fX(x) dx.f_Y(y)=\int_{-\infty}^{\infty} f_{Y\mid X=x}(y)f_X(x)\,dx.

This is the density version of the law of total probability. It is useful when a model has a random parameter: first choose a parameter, then generate an outcome using it. The next article uses the same idea to average conditional means and variances.

Common misunderstandings

The support can change when we condition. In the triangle, 0<Y<X0<Y<X always. Holding X=xX=x leaves 0<Y<x0<Y<x, not 0<Y<10<Y<1.

A conditional density is still a density. Its value at one point is not the probability of that exact value. Integrate it over an interval to get a probability.

Further reading