Two clouds of points fall, and each casts a shadow on its two axes. Watch the shadows, then look at the clouds.
A cloud and its shadows
1000 pairs of numbers in each cloud, made by a computer (seed 3100).
Two clouds of 1000 points: on the left, two numbers that ignore each other; on the right, a second number that follows the first.
Describe this picture
Two panels, side by side on a wide screen and stacked on a phone, each with axes from to : a “round cloud” and a “tilted cloud”. In each, 1000 seeded points pour into a cloud, and two histograms grow along the edges: one under the cloud, counting the first numbers, and one at its side, counting the second numbers. Both clouds share their first numbers. The left cloud is round. The right cloud is tilted, rising from bottom left to top right. When the points are in, a dotted standard normal bell is drawn over each of the four edge histograms: they look the same. When the clip has finished, a slider, “Slice at x”, places a vertical slice from to , from to , in both panels at once; its points are lit, and beside each cloud a histogram of their second numbers replaces the shadow, with a dashed mark at the exact slice mean. Readouts give the points in the slice and, for each cloud, their mean and spread. At the slice holds 53 points: mean and spread 0.934 on the left, mean 1.192 and spread 0.592 on the right; the exact values are mean 0 and spread 1, and mean 1.2 and spread 0.6.
A cloud and its shadows
So far each random variable has been alone. But measurements often come in pairs: a person’s height and weight, the temperature and the number of ice creams sold, the two parts of a noisy radio signal. To describe a pair I need both numbers at once.
Draw each pair as a point, and many pairs make a cloud. In the picture at the top of the page, the left cloud is round and the right cloud is tilted. In the tilted one, a large first number usually comes with a large second number.
Now look at the edges. The histogram under each cloud counts only the first numbers, as if the cloud cast a shadow straight down. The one at the side counts only the second numbers. Those shadows are the marginal distributions, and in the picture all four are the same bell.
So the shadows do not tell you the cloud. Two very different pairs of variables can have exactly the same marginals. To know how two variables behave together, you need the whole cloud, the joint distribution.
Tables first
The cleanest way to see this is with a table. Let be 0 or 1 and be 0, 1 or 2. The joint distribution gives the chance of each pair, :
| by | row total | |||
|---|---|---|---|---|
| 0.10 | 0.20 | 0.10 | 0.40 | |
| 0.05 | 0.15 | 0.40 | 0.60 | |
| column total | 0.15 | 0.35 | 0.50 | 1 |
The six chances add up to 1. The shadows are the totals at the edges. Add along a row to get the chance of each value of , and down a column for :
So and . For variables with a density, like the clouds above, the same idea holds with a joint density and integrals in place of sums.
A slice: the conditional distribution
Now suppose you learn that . Only the second row is still possible. Its chances add up to 0.60, not 1, so divide each by 0.60:
Given , is 0, 1 or 2 with chances , and . That is the conditional distribution of given , the rule of Conditional probability applied to every value at once. Its mean is . Given , the chances are , and , and the mean is .
In the cloud, a condition is a slice. After the clip, drag the slice to . In the round cloud, the points in the slice are spread around 0, as if you had learned nothing. In the tilted cloud they sit higher, around 1.2, and closer together. In the clip’s 1000 points, the slice holds 53, with means and 1.192 and spreads 0.934 and 0.592.
The mean of a slice, , is the conditional mean. It is the best guess of once you know : of all guesses that depend only on , it gives the smallest average squared miss. Averaging the slice means with the chances of each slice gives back the overall mean: , which is .
For the clouds in the picture, both variables have mean 0 and spread 1, and the tilt is set by a number , the correlation, which the page Covariance and correlation defines: 0 on the left and 0.8 on the right. For clouds of this kind, the bivariate normal, a slice at has
With and , the mean is and the spread is .
Independence is a product
Two variables are independent, as in Independence, when learning one tells you nothing about the other. In a table, that means every slice has the same shape as the shadow. Equivalently, every cell is the product of its row total and its column total:
The table above fails at the first cell: , but . So and are dependent. Here is the table that has the same totals and is independent:
| by | row total | |||
|---|---|---|---|---|
| 0.06 | 0.14 | 0.20 | 0.40 | |
| 0.09 | 0.21 | 0.30 | 0.60 | |
| column total | 0.15 | 0.35 | 0.50 | 1 |
Same shadows, different joint distributions: the table version of the two clouds.
Worked example
- A shadow. .
- A slice. .
- Dependent. , but .
- Conditional means. Given , the mean of is ; given , it is ; overall, .
- The twin table. With the same totals and independence, the rows are and .
- A cloud slice. With , both spreads 1 and both means 0, the slice at has mean and spread .
Where you’ll meet this
A radio receiver’s noise has two parts, in phase and in quadrature, and their joint distribution is a round cloud like the left one. Two sensors that measure the same room share a tilted cloud. Neighbouring pixels in a photograph are a tilted cloud too, which is why one pixel predicts the next so well, and why images compress.
In signal processing · noise clouds and best guesses
The page I/Q and complex baseband draws received symbols as points in a plane, and noise turns each point into a round cloud. The page The Wiener filter makes the best guess of a clean signal from a noisy one; for the bell-shaped noise it assumes, that guess is the conditional mean of this page. One difference in writing: signal processing pages write a random signal in lower case, , and a density as ; here random variables are capitals and a density is .
Where this leads · the shape of the cloud
The tilted cloud’s oval outline is the picture of a symmetric matrix, its covariance matrix, which Symmetric matrices in the linear algebra course takes apart.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Joint | density for continuous | |
| Marginal | the shadow on one axis | |
| Conditional | a slice, rescaled | |
| Conditional mean | best guess of from | |
| Independent | everywhere | every slice looks like the shadow |
| Bivariate normal slice | mean , variance | narrower when is large |
| Marginals | do not fix the joint | same shadows, different clouds |