[MUSIC PLAYING]
COMMERCIAL ANNOUNCER: Bayesium 2O, our pure, natural refreshing mineral water
comes from the ancient river Stats.
Best of all, a bottle of Bayesium 2O has 200 milligrams
of Bayesium, a mineral that four out of five doctors
believe reduces the risk conditionitis.
JOE BLITZSTEIN: Jimmy goes to the grocery store, Bayesmart,
to buy some water.
He wonders what the company means when they say a bottle of Bayesium
2O 200 milligrams of Bayesium.
Is that on average?
Could it vary a lot by bottle?
And how many doctors were surveyed?
And how can they distinguish correlation from causation?
JIMMY: Hmm, sources--
Bayesville, Continuopolis, and/or Discretown?
Are there major differences between these sources?
JOE BLITZSTEIN: Three segments of the Stats River
are used as sources for Bayesium 2O, one in Bayesville, one in Continuopolis,
and one in Discretown.
The average Bayesium level is different for these three sources.
On average, a bottle sourced from Bayesville has 250 milligrams
of Bayesium a bottle from Continuopolis has 190 milligrams,
and a bottle from Discretown has 160 milligrams.
Even within each of these sources, there is variation.
For a random bottle, how much Bayesium do expect it to contain?
Is it the simple average, 200 milligrams--
A, it is the simple average, B, it's more than the simple average,
C, it's less than the simple average, or D, it depends.
As in so many other situations, the answer is that it depends.
The average Bayesium level is a weighted average
of the separate average Bayesium levels for the three cities, where
the weights depend on what proportion of water
is sourced from each of the cities.
The simple average makes sense if 1/3 of the water
comes from each of the cities.
But if, for example, 2/3 of the water comes from Discretown, and only 1/6
comes from Bayesville and 1/6 from Continuopolis,
then the overall average is 180 milligrams.
In general, let Y be the Bayesium content of a random water bottle,
and B, C, and D be the events that the water in the bottle
comes from Bayesville, Continuopolis, and Discretown, respectively.
Then, the overall average is a weighted average of the separate averages.
The expected value of Y is E of Y given B, P of B plus E of Y
given C, P of C plus E of Y given D, P of D.
We'll let X be a random variable that indicates
which city the water comes from.
Say, with X equals 1 meaning Bayesville, X equals 2 meaning Continuopolis,
and X equals 3 meaning Discretown.
The above identity can be expressed even more compactly as E of Y
equals E of E of Y given X. This identity is known
as iterated expectation, or Adam's law.
Jimmy is also concerned about how much the Bayesium
content varies by bottle, not just the average amount in a bottle.
Suppose that the bottle is equally likely
to be sourced from each of the three cities.
For each source, water bottles have a standard deviation
of 10 milligrams in their Bayesium content.
What is the overall standard deviation of Bayesium content
in a random water bottle--
A, 10 milligrams, B, more than 10 milligrams, C, less than 10 milligrams,
or D, it depends?
JIMMY: Is the overall variance the weighted average of the three
separate variances?
JOE BLITZSTEIN: We can answer Jimmy's question visually.
If the answer is yes, then moving a city's pile
will not change the overall standard deviation.
But in general, the overall standard deviation
does change when we move a pile, even though we are not changing
the separate standard deviations.
The key is that there are two types of variation.
The Bayesium content varies within each city,
and it also varies between cities.
Remarkably, we can get the overall variance simply
by adding these two contributions.
The variance of Y is E of the variance of Y given X
plus the variance of E of Y given X.
The first term is the average of the separate variances for each city.
The second term is the variance between the separate averages for each city.
This identity is known as Eve's law.
In this example, the variance of Y given X is 100, since within each city
the variance is 100.
And E of Y given X is 250 if X equals 1, 190 if X equals 2,
and 160 if X equals 3, which gives that the variance of E of Y
given X is 1,400.
By Eve's law, the variance of Y is 100 plus 1,400, which is 1,500.
The standard deviation is the square root
of this variance, which is about 40 milligrams.
This is much higher than 10 milligrams.
Just using the average of the three separate variances
ignores the second term in Eve's law.
Jimmy is right to be skeptical and to seek more refined data.
With multiple sources of water, there are multiple sources of variation.
[MUSIC PLAYING]