Tutorials › Statistical Theory I - Probability and Distribution Theory › Diagnosing Independence Claims in Worked Examples

Independence and Dependence · Tutorial 246 of 994

Diagnosing Independence Claims in Worked Examples

Practice deciding whether discrete variables, continuous variables, or two events are independent by checking the right factorization completely.

Intermediate 10 min read

What You'll Learn

  • Test a discrete joint table by checking every cell against the product of its marginal probabilities.
  • Distinguish a complete table check from a coincidental match in one cell.
  • Diagnose independence from a joint density and its marginal densities, with equality understood almost everywhere.
  • Test whether two events are independent using their intersection probability.
  • Identify why matching marginals or a plausible-looking support does not establish independence.

What Counts as a Convincing Independence Check?

An independence claim is a statement about an entire joint distribution, not one convenient feature of it. For two discrete random variables, every joint probability must agree with the product of the corresponding marginal probabilities. For variables with a joint density, the joint density must agree almost everywhere with the product of the marginal densities. For two events, the test is a single intersection identity. These are related checks, but the amount of work they require is different.

A marginal distribution describes one variable at a time. Even when two marginals look reasonable, or a particular joint probability happens to match its product-of-marginals value, dependence may remain elsewhere in the joint distribution. The practical question is therefore: what must be checked completely for this kind of claim?

Definition: Random variables \(X\) and \(Y\) are independent if, for every pair of measurable sets \(A\) and \(B\), \(P(X\in A,Y\in B)=P(X\in A)P(Y\in B)\). Events \(C\) and \(D\) are independent if \(P(C\cap D)=P(C)P(D)\).

Discrete Tables: Check Every Cell

Suppose \(X\) takes values \(x_1,\ldots,x_r\) and \(Y\) takes values \(y_1,\ldots,y_s\). Write \(p_{ij}=P(X=x_i,Y=y_j)\), \(p_{i+}=P(X=x_i)\), and \(p_{+j}=P(Y=y_j)\). The marginal probabilities are obtained by summing the joint table across the other variable.

Discrete-table criterion: \(X\) and \(Y\) are independent if and only if \(p_{ij}=p_{i+}p_{+j}\) for every \(i=1,\ldots,r\) and \(j=1,\ldots,s\).

To prove the criterion, first suppose \(X\) and \(Y\) are independent. Apply the definition to the singleton sets \(\{x_i\}\) and \(\{y_j\}\). This gives \(p_{ij}=p_{i+}p_{+j}\) for every cell. Conversely, suppose that factorization holds in every cell. For any sets of possible values \(I\) and \(J\),

$$ P(X\in I,Y\in J) =\sum_{x_i\in I}\sum_{y_j\in J}p_{ij} =\sum_{x_i\in I}\sum_{y_j\in J}p_{i+}p_{+j} =P(X\in I)P(Y\in J). $$

The factorization therefore holds for all such sets, which is independence. Checking every cell is sufficient; checking only a selection of cells generally is not.

Worked Example: A Table That Factors Completely

The joint probabilities of \(X\) and \(Y\) are shown below. Decide whether the variables are independent.

\(Y=0\)\(Y=1\)\(Y=2\)Row total
\(X=0\)0.100.060.040.20
\(X=1\)0.400.240.160.80
Column total0.500.300.201.00

The row and column totals are the marginal probabilities. Check each cell against the product of its row and column totals:

$$ \begin{aligned} 0.20(0.50)&=0.10, & 0.20(0.30)&=0.06, & 0.20(0.20)&=0.04,\\ 0.80(0.50)&=0.40, & 0.80(0.30)&=0.24, & 0.80(0.20)&=0.16. \end{aligned} $$

All six joint probabilities factor. Thus \(X\) and \(Y\) are independent. The verification is complete because the table has only six cells and each one has been checked.

Worked Example: One Matching Cell Does Not Settle a Larger Table

Consider a joint table with row totals \(0.50,0.30,0.20\) and column totals \(0.40,0.60\):

\(Y=0\)\(Y=1\)Row total
\(X=1\)0.200.300.50
\(X=2\)0.050.250.30
\(X=3\)0.150.050.20
Column total0.400.601.00

The cell for \(X=1,Y=0\) matches its product of marginals: \(0.20=(0.50)(0.40)\). But another cell does not: \(P(X=2,Y=0)=0.05\), whereas \(P(X=2)P(Y=0)=(0.30)(0.40)=0.12\). Since even one cell fails, \(X\) and \(Y\) are dependent.

This is a useful warning about partial checks. In a table with at least three categories for one variable, a single matching cell does not establish independence. In a \(2\)-by-\(2\) table, however, matching one cell together with the marginal totals forces the other three to match as well. Do not assume that shortcut applies to a larger table.

Joint Densities: Factorization Almost Everywhere

For continuous random variables, the corresponding check concerns densities. Suppose \((X,Y)\) has a joint density \(f_{X,Y}\) with respect to two-dimensional Lebesgue measure. Its marginal densities are \(f_X(x)=\int_{\mathbb R} f_{X,Y}(x,y)\,dy\) and \(f_Y(y)=\int_{\mathbb R} f_{X,Y}(x,y)\,dx\), for almost every \(x\) and \(y\). These integrals exist as marginal densities because the joint density is nonnegative and integrates to one.

Joint-density criterion: If \((X,Y)\) has a joint density, then \(X\) and \(Y\) are independent if and only if \(f_{X,Y}(x,y)=f_X(x)f_Y(y)\) for Lebesgue-almost every \((x,y)\).

For the forward direction, independence means that the joint distribution is the product of the two marginal distributions. A density for that product distribution is \(f_X(x)f_Y(y)\). The joint distribution also has density \(f_{X,Y}\). Densities of the same distribution are equal almost everywhere, so the stated factorization follows. For the reverse direction, suppose the factorization holds almost everywhere. For any measurable sets \(A,B\subseteq\mathbb R\), integration over their product gives

$$ \begin{aligned} P(X\in A,Y\in B) &=\int_A\int_B f_{X,Y}(x,y)\,dy\,dx\\ &=\int_A\int_B f_X(x)f_Y(y)\,dy\,dx\\ &=\left(\int_A f_X(x)\,dx\right) \left(\int_B f_Y(y)\,dy\right)\\ &=P(X\in A)P(Y\in B). \end{aligned} $$

The product integration is valid for these nonnegative densities by Tonelli's theorem. This proves independence and establishes the criterion. The phrase “almost everywhere” matters: changing a density on a set of Lebesgue measure zero does not change the distribution, so independence does not require a pointwise identity at every point.

Worked Example: A Triangular Support Rules Out Independence

Let the joint density be \(f_{X,Y}(x,y)=2\) when \(0<x<1\), \(0<y<1-x\), and zero otherwise. First check its total integral:

$$ \int_0^1\int_0^{1-x}2\,dy\,dx =\int_0^1 2(1-x)\,dx =1. $$

For \(0<x<1\), the marginal density of \(X\) is \(f_X(x)=\int_0^{1-x}2\,dy=2(1-x)\), and it is zero outside that interval. By symmetry, \(f_Y(y)=2(1-y)\) for \(0<y<1\), and zero otherwise.

On the square \(0<x<1,\ 0<y<1\), the product \(f_X(x)f_Y(y)=4(1-x)(1-y)\) is positive. But on the region \(x+y>1\) inside that square, the joint density is zero. This discrepancy is not confined to a measure-zero boundary: for example, the rectangle \(0.7<x<0.8,\ 0.7<y<0.8\) has positive area, and throughout it the joint density is zero while the product of marginal densities is positive. The factorization fails on a set of positive area, so \(X\) and \(Y\) are dependent.

Event Pairs: Test the Intersection

For two events, there is no table or density to factor across every possible value. The definition itself gives the complete test: compare the probability of their intersection with the product of their individual probabilities. Both sides must be calculated from the same probability model.

Worked Example: Two Events on a Fair Die

Roll a fair six-sided die. Let \(C\) be the event that the result is even and \(D\) the event that the result exceeds \(3\). Then \(C=\{2,4,6\}\), so \(P(C)=3/6=1/2\), and \(D=\{4,5,6\}\), so \(P(D)=3/6=1/2\). Their intersection is \(\{4,6\}\), giving \(P(C\cap D)=2/6=1/3\). Since

$$ P(C\cap D)=\frac{1}{3}\ne\frac{1}{2}\cdot\frac{1}{2} =P(C)P(D)=\frac{1}{4}, $$

the events are dependent. The fact that both events have probability \(1/2\) says nothing by itself about whether they are independent; it is the intersection probability that decides this claim.

Common Mistakes and a Reliable Checklist

Some checks can quickly disprove independence, but they are not substitutes for the relevant complete criterion. For example, a zero-probability joint cell with positive marginal probabilities disproves independence immediately, because the product of those marginals is positive. Likewise, one failed density comparison on a positive-measure region disproves independence. A successful partial check, by contrast, usually cannot establish the claim.

  • Wrong: “One table cell equals the product of its marginals, so the variables are independent.” Correction: For a general discrete table, check every cell. One failure is enough to conclude dependence; one match is not enough to conclude independence.
  • Wrong: “The marginal distributions look unrelated, so the variables are independent.” Correction: Independence is a property of the joint distribution. Marginals alone do not reveal whether the joint probabilities or density factor completely.
  • Wrong: “The density factorization fails at one point, so the variables are dependent.” Correction: Densities are defined only up to changes on null sets. For a density-based independence check, a failure must occur on a set of positive Lebesgue measure.
  • Wrong: “Two events each have probability one-half, so they are independent.” Correction: Calculate \(P(C\cap D)\) and compare it with \(P(C)P(D)\).

A practical workflow is to identify the object being tested first: a pair of events, a discrete joint table, or a joint density. Then calculate the relevant marginals, state the factorization condition, and check it at the right level of completeness. This keeps a tempting numerical coincidence from being mistaken for evidence of independence.

Check Your Understanding

For each question, identify what must be checked before making an independence claim.

  1. A discrete joint table has five rows and two columns. How many cells must factor as the product of their marginal probabilities to establish independence?
  2. In a table with three categories for \(X\) and two for \(Y\), one cell matches its product of marginals. Does that establish independence? Explain.
  3. A joint density and the product of its marginal densities differ only at one point. Does that alone disprove independence? Why or why not?
  4. Two events have probabilities \(0.3\) and \(0.4\), and their intersection has probability \(0.12\). Are they independent? Show the comparison.
  5. For the triangular density in the worked example, why does the zero joint density on a region above the line \(x+y=1\) disprove independence?