Hexa Scholar

Joint distributions: same margins, different dependence

A clay tray with a three-by-three grid of compartments holding stacks of gold coins, with notched wooden rails along its right and bottom edges and a brass scoop pouring coins into one compartment.
A tray of coin stacks with fixed rails along two edges.

The question

A joint table of X and Y has row totals 0.6 and 0.4, column totals 0.7 and 0.3. Which cells make X and Y independent?

And what can a third variable do to independence?

  1. 1 SeeFill in tables with fixed totals. 3 rounds.
  2. 2 TryAdd a third variable and predict.
  3. 3 ProveBuild a proof about mixing two groups.
  4. 4 ApplyTables, bounds, loans and screening checks.
Before you start · 3 quick checks on conditional probability, mass functions and independent events, about 3 min

Two ideas before you start

2 ideas

A table and its totals

Figure: a two by two joint table of X and Y with its row and column totals; in each of the three tables every total is 0.5. It needs JavaScript.

Table

P(X = 1) = 0.5 + 0 = 0.5

Each cell is the probability of one pair of values. A row adds up to the probability of that value of X, and a column to the probability of that value of Y. The three tables have the same totals but different cells.

Exact definition

Joint and marginal distributions. Let \(X\) and \(Y\) be random variables on the same experiment, each with finitely many values. Their joint distribution is the table of probabilities \(P(X = x, Y = y)\), one for each pair of values. The marginal distributions are the distributions of \(X\) and of \(Y\) alone, the row and column totals:

\[\begin{aligned} P(X = x) &= \sum_{y} P(X = x, Y = y), \\ P(Y = y) &= \sum_{x} P(X = x, Y = y). \end{aligned}\]

The joint distribution determines both marginals, but the marginals do not determine the joint distribution.

Independent: every cell is a product of its totals

Figure: the picked table as a mosaic, one column for each value of X, split into a lower band for Y = 0 and an upper band for Y = 1, with a dashed line at half the height. It needs JavaScript.

Table

P(X = 1, Y = 1) = 0 vs P(X = 1) P(Y = 1) = 0.25

Tap a table to test it.

In the mosaic each column is one value of X, and its bands show how Y splits given that value. X and Y are independent when every column splits the same way, at the dashed line.

Exact definition

Independent random variables. \(X\) and \(Y\), each with finitely many values, are independent when

\[P(X = x, Y = y) = P(X = x)\,P(Y = y)\]

for every value \(x\) of \(X\) and every value \(y\) of \(Y\). Equivalently, for every \(x\) with \(P(X = x) \gt 0\), the conditional distribution of \(Y\) given \(X = x\) is the marginal distribution of \(Y\): \(P(Y = y \mid X = x) = P(Y = y)\) for every \(y\).

Fine print: what this page assumes

Every random variable on this page takes finitely many values, and every event the page conditions on has positive probability. All the probabilities are model numbers chosen for the examples, not data.

For continuous random variables the table becomes a joint density \(f(x, y)\), the totals become integrals, \(f_{X}(x) = \int f(x, y)\,dy\), and independence means \(f(x, y) = f_{X}(x)\,f_{Y}(y)\); the lesson on PMF, PDF and CDF covers one variable. The point of this page carries over: two stock prices can each have a lognormal distribution, and those two marginals still do not determine the joint distribution of the two prices.

1 See

Make the table independent

Each column is one value of X, as wide as its probability. Inside a column the bands from the bottom are Y = 0, Y = 1 and, in round 3, Y = 2, from the faintest to the strongest shading, each as tall as its probability given that value of X. When a round is solved, dashed lines mark where the band edges sit in every column.
2 Try

A third variable

Definition

Let \(Z\) be a third random variable with finitely many values. \(X\) and \(Y\) are independent given \(Z\) when, for every value \(z\) with \(P(Z = z) \gt 0\) and all values \(x\) and \(y\),

\[\begin{aligned} &P(X = x, Y = y \mid Z = z) \\ &= P(X = x \mid Z = z) \\ &\quad \times P(Y = y \mid Z = z). \end{aligned}\]

Each value of \(Z\) gives its own joint table, and each of those tables is independent in the sense of stage 1.

Two questions come first. The explorer below them opens once both are answered.

The explorer opens when you have answered the two questions above.

3 Prove

What mixing two groups does to independence

Theorem

Assumptions. \(Z\), \(X\) and \(Y\) each take the values 0 and 1, and \(\pi = P(Z = 1)\) with \(0 \lt \pi \lt 1\). Given each value of \(Z\), \(X\) and \(Y\) are independent, with \(a_{z} = P(X = 1 \mid Z = z)\) and \(b_{z} = P(Y = 1 \mid Z = z)\) for \(z = 0, 1\). Every \(a_{z}\) and \(b_{z}\) is strictly between 0 and 1, and \(a_{0} \ne a_{1}\), \(b_{0} \ne b_{1}\): the value of \(Z\) changes the probabilities of both.

Conclusion. Let \(\Delta\) be the gap between the cell \((X = 1, Y = 1)\) and the product of its totals. Then

\[\begin{aligned} \Delta &= P(X = 1, Y = 1) \\ &\quad - P(X = 1)\,P(Y = 1) \\ &= \pi(1 - \pi)(a_{1} - a_{0})(b_{1} - b_{0}), \end{aligned}\]

which is not 0. So \(X\) and \(Y\) are not independent, although they are independent given \(Z\). \(\Delta \gt 0\) when \(a\) and \(b\) move in the same direction from \(z = 0\) to \(z = 1\), and \(\Delta \lt 0\) when they move in opposite directions.

Facts the proof uses.

  • the law of total probability, from the lesson on conditional probability: for every event \(A\), \[\begin{aligned} P(A) &= P(Z = 0)\,P(A \mid Z = 0) \\ &\quad + P(Z = 1)\,P(A \mid Z = 1); \end{aligned}\]
  • independence given \(Z\), from the definition in stage 2.

Each option is one sentence about the \(X\), \(Y\) and \(Z\) of the theorem. Pick the one that is true for every \(\pi\), \(a_{0}\), \(a_{1}\), \(b_{0}\) and \(b_{1}\) the assumptions allow.

What else follows
    4 Apply

    Problems

    Each problem states its model and has hints and a full solution. Answers can be typed as decimals or as fractions.

    Key point A joint table holds more than its totals: the totals fix the marginal distributions, and the cells fix the dependence. Independence is the one table whose cells are all products of their totals. Conditional probabilities come from a single row or column, and a third variable can create or remove dependence, so a model has to say which variables are independent and given what.
    Level Intermediate Prerequisites Conditional probability and the Monty Hall problem; PMF, PDF and CDF Time ~35 min

    Further reading