Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

What does the joint distribution of XX and YY tell us about the distribution of XX alone?

Everything, of course. Let’s see how.

🎥 See More
Loading...

Here is the joint distribution table of two random variables XX and YY.

joint_table
Loading...

To find the distribution of XX we need the possible values of XX and all their probabilities.

At a glance, you can see that the possible values of XX are 0, 1, and 2.

Let’s look at the event {X=0}\{ X = 0 \}.

def indicator_X_equals_0(i, j):
    return i == 0

joint_table.event(indicator_X_equals_0, 'X', 'Y')
P(Event) = 0.25
Loading...

These are the cells in the column labeled X=0. The sum of the probabilities in those cells is P(X=0)=0.25P(X = 0) = 0.25.

4.3.1Partitioning {X=x}\{X = x \} According to YY

In every cell of the column labeled X=0, the value of XX is 0 and the value of YY is some possible value of YY. So the column X=0 partitions the event {X=0}\{X = 0\} according to the value of YY, and displays the probability of each piece of the partition.

In other words, for every xx we have

{X=x}=all y{X=x,Y=y}\{X = x \} = \bigcup_{\text{all } y} \{X = x, Y = y\}

and this is a disjoint union. So by the addition rule,

P(X=x)=all yP(X=x,Y=y)P(X = x) = \sum_{\text{all } y} P(X = x, Y = y)

That is, P(X=x)P(X = x) is the sum of the probabilities in the column X=x. Because P(X=x)P(X = x) is the generic term in the distribution of XX, we have learned that we can derive the distribution of XX from the joint distribution of XX and YY.

4.3.2Marginal Distribution of XX

To find the numerical values of the distribution of XX, 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')
Loading...

Now at the bottom of the table you have all the column sums, which constitute the probabilities in the distribution of XX.

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 XX when the distribution has been derived from a joint distribution.

You should recognize that XX has the same distribution as the number of heads in two tosses of a coin.

4.3.3Both Marginals

What you can do for XX, you can do as well for YY by looking along the rows.

joint_table.marginal('Y')
Loading...

You can also get both marginals at once:

joint_table.both_marginals()
Loading...

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.