What does the joint distribution of and tell us about the distribution of alone?
Everything, of course. Let’s see how.
🎥 See More
Here is the joint distribution table of two random variables and .
joint_tableTo find the distribution of we need the possible values of and all their probabilities.
At a glance, you can see that the possible values of are 0, 1, and 2.
Let’s look at the event .
def indicator_X_equals_0(i, j):
return i == 0
joint_table.event(indicator_X_equals_0, 'X', 'Y')P(Event) = 0.25
These are the cells in the column labeled X=0. The sum of the probabilities in those cells is .
4.3.1Partitioning According to ¶
In every cell of the column labeled X=0, the value of is 0 and the value of is some possible value of . So the column X=0 partitions the event according to the value of , and displays the probability of each piece of the partition.
In other words, for every we have
and this is a disjoint union. So by the addition rule,
That is, is the sum of the probabilities in the column X=x. Because is the generic term in the distribution of , we have learned that we can derive the distribution of from the joint distribution of and .
Answer
(a) 4 (b)
4.3.2Marginal Distribution of ¶
To find the numerical values of the distribution of , we will use a method called marginal that operates on a joint distribution object and takes the variable name as its argument. The reason for using the word “marginal” will become clear as soon as we see the output.
joint_table.marginal('X')Now at the bottom of the table you have all the column sums, which constitute the probabilities in the distribution of .
Because the sums appear in the margin of the table, the distribution is called marginal. It’s a bit silly. But “marginal” is a commonly used term for the probability distribution of when the distribution has been derived from a joint distribution.
You should recognize that has the same distribution as the number of heads in two tosses of a coin.
4.3.3Both Marginals¶
What you can do for , you can do as well for by looking along the rows.
joint_table.marginal('Y')You can also get both marginals at once:
joint_table.both_marginals()The bottom right corner cell is the sum of all the probabilities in the table, and also the sum of all the probabilities in each of the margins. Reassuringly, it’s 1.