Joint and Marginal Distributions

A joint distribution describes two random quantities together; marginal distributions describe each one separately.

Draft — not yet reviewed by the site owner.

Prerequisites: Random Variables.

A joint distribution tells us how two random variables behave together. It can answer questions such as “How likely are a long wait and a late arrival on the same trip?” A marginal distribution tells us about either variable alone, after we ignore the other one.

Think of a map

For two continuous variables XX and YY, picture a map whose horizontal coordinate is xx and vertical coordinate is yy. A joint density fX,Y(x,y)f_{X,Y}(x,y) gives the amount of probability per unit area near each point. The probability of a region is the volume under the density above that region. The set of points where the density can be positive is its support.

If we want the distribution of XX alone, we collect all the probability along the vertical direction. This is called marginalizing out YY:

fX(x)=∫−∞∞fX,Y(x,y) dy.f_X(x)=\int_{-\infty}^{\infty} f_{X,Y}(x,y)\,dy.

The bounds must respect the support. If the allowed yy values depend on xx, the effective bounds do too.

A triangular region between y equals zero and y equals x for x between zero and one. A vertical slice at x equals three quarters runs from y equals zero to three quarters; its length represents the marginal density of X at that x.
A model joint density equal to 2 on the triangle 0 < y < x < 1, and zero elsewhere. The highlighted vertical slice at x = 0.75 has height 0.75, so its density integrates to f_X(0.75) = 2 × 0.75 = 1.5. Density can exceed 1; probability is area times density.

For discrete variables, replace the map by a table. Each cell is a probability pX,Y(x,y)=P(X=x,Y=y)p_{X,Y}(x,y)=P(X=x,Y=y). Add a row or column to get a marginal probability. In the continuous case, we integrate instead of adding.

A triangular example

Suppose the pair (X,Y)(X,Y) has joint density

fX,Y(x,y)=2when 0<y<x<1,f_{X,Y}(x,y)=2 \quad\text{when }0<y<x<1,

and zero elsewhere. The triangle has area 1/21/2, so a constant density of 2 gives total probability 1. The density is not a probability at a single point.

At a fixed xx between 0 and 1, yy runs from 0 to xx. Therefore

fX(x)=∫0x2 dy=2x,0<x<1.f_X(x)=\int_0^x 2\,dy=2x,\qquad 0<x<1.

At a fixed yy, xx runs from yy to 1, giving

fY(y)=∫y12 dx=2(1−y),0<y<1.f_Y(y)=\int_y^1 2\,dx=2(1-y),\qquad 0<y<1.

Both densities are zero outside their stated intervals. They each integrate to 1. For example, the chance that YY is below 1/41/4 is

P(Y<1/4)=∫01/42(1−y) dy=716.P(Y<1/4)=\int_0^{1/4}2(1-y)\,dy=\frac{7}{16}.

What a marginal leaves out

The two marginals do not usually determine the joint distribution. Knowing the distribution of each person’s height and each person’s weight separately does not tell us which heights go with which weights. That pairing is the information in the joint distribution.

If XX and YY are independent, the joint density factors as fX,Y(x,y)=fX(x)fY(y)f_{X,Y}(x,y)=f_X(x)f_Y(y) (where densities exist). In the triangular example, independence is impossible: knowing X=xX=x tells us Y<xY<x, so learning XX changes what values of YY are possible.

For more than two variables the idea is the same, but a marginal may require integrating out several coordinates. The next step is to keep one coordinate fixed and describe the remaining uncertainty with a conditional distribution.

Further reading