Tutorials › Exam P - Probability › Testing Independence in Discrete Tables

Exam P · Conditional Distributions and Independence · Tutorial 743 of 915

Testing Independence in Discrete Tables

Use row and column marginals to test discrete-table independence carefully, and learn why every cell matters.

Intermediate 9 min read

What You'll Learn

  • Identify joint probabilities and calculate row and column marginal probabilities.
  • Test independence by comparing each cell with its marginal-product value.
  • Explain why checking all outcome pairs establishes independence.
  • Handle count tables and outcomes with zero marginal probability.
  • Recognize why matching one cell does not establish independence.
  • Distinguish a probability-model independence check from a statistical significance test.

Why Test Independence From a Table?

A joint probability table describes how two discrete random variables behave together. Its row and column totals show each variable’s marginal distribution, but those margins alone do not reveal whether the variables are independent. Independence requires a specific relationship: for every possible pair of outcomes, the joint probability must equal the product of the two corresponding marginal probabilities.

This is a direct test for a probability model, not a statistical test based on a sample. The entries are treated as probabilities describing the model. When a table instead gives observed counts, first decide whether the counts represent a complete finite probability model or are sample data for a separate inferential question. Here, the task is to check independence in a discrete probability table.

Definition: For discrete random variables \(X\) and \(Y\), write \(p_{X,Y}(x,y)=P(X=x,Y=y)\), \(p_X(x)=P(X=x)\), and \(p_Y(y)=P(Y=y)\). The variables are independent if and only if $$ p_{X,Y}(x,y)=p_X(x)p_Y(y) $$ for every possible pair \((x,y)\). In a joint table, the marginal probabilities \(p_X(x)\) are the row totals and \(p_Y(y)\) are the column totals.

To use the test, calculate the row and column totals, form the product of the relevant row and column totals for each cell, and compare that product with the actual joint probability in the cell. Independence is established only if the equality holds throughout the table. A single mismatch proves dependence.

How the Cell-Product Test Works

The rule follows from the definition of independence. If \(X\) and \(Y\) are independent, the events \(\{X=x\}\) and \(\{Y=y\}\) are independent. Therefore their intersection has probability \(P(X=x)P(Y=y)\), and that intersection is exactly the event \(\{X=x,Y=y\}\). This gives the cell-product equality.

For the converse, suppose the equality holds for every pair of outcomes. For any sets of possible values \(A\) and \(B\), add the joint probabilities over all pairs with \(x\in A\) and \(y\in B\):

$$ \begin{aligned} P(X\in A,Y\in B) &=\sum_{x\in A}\sum_{y\in B}p_{X,Y}(x,y)\\ &=\sum_{x\in A}\sum_{y\in B}p_X(x)p_Y(y)\\ &=\left(\sum_{x\in A}p_X(x)\right) \left(\sum_{y\in B}p_Y(y)\right)\\ &=P(X\in A)P(Y\in B). \end{aligned} $$

That is the event-based definition of independence. Thus checking every outcome pair in the table is both necessary and sufficient; it is not merely a convenient set of examples.

1
Check the table.
Confirm the entries are nonnegative and sum to 1. If the table gives counts, identify the total count before converting to probabilities.
2
Find both marginals.
Add across each row to find \(p_X(x)\), and down each column to find \(p_Y(y)\).
3
Compare every cell.
For each row-column pair, calculate the product of its row and column marginal probabilities, then compare it with the joint probability shown in that cell.
4
State the conclusion.
If any cell differs, the variables are dependent. If all cells agree, they are independent.

Worked Independence Checks

Worked Example: Testing a Two-Row, Three-Column Table

A hypothetical reliability model assigns the following joint probabilities to the alert category \(X\) and inspection outcome \(Y\). Determine whether \(X\) and \(Y\) are independent.

\(Y=A\)\(Y=B\)\(Y=C\)Row total
\(X=0\)0.100.200.10
\(X=1\)0.200.100.30
Column total

Method: calculate the margins, then check the cell products. First verify that the joint probabilities sum to 1: \(0.10+0.20+0.10+0.20+0.10+0.30=1.00\). The row totals are \(P(X=0)=0.10+0.20+0.10=0.40\) and \(P(X=1)=0.20+0.10+0.30=0.60\).

The column totals are \(P(Y=A)=0.10+0.20=0.30\), \(P(Y=B)=0.20+0.10=0.30\), and \(P(Y=C)=0.10+0.30=0.40\). Now check the cells. For \(X=0,Y=A\), the product is \(0.40(0.30)=0.12\), whereas the joint probability is \(0.10\). Since \(0.12\ne0.10\), this single cell disproves independence.

For completeness, the six products, listed in table order, are \(0.12, 0.12, 0.16, 0.18, 0.18,\) and \(0.24\); the corresponding joint probabilities are \(0.10, 0.20, 0.10, 0.20, 0.10,\) and \(0.30\). They do not agree cell by cell. Therefore \(X\) and \(Y\) are dependent.

Common mistake avoided: A table may have valid margins and still describe dependent variables. Summing to 1 verifies that it is a probability table; it does not verify independence.

Worked Example: One Matching Cell Is Not Enough

A hypothetical scheduling model has joint probabilities shown below. Test whether the scheduling category \(X\) and the result \(Y\) are independent.

\(Y=0\)\(Y=1\)
\(X=1\)0.080.12
\(X=2\)0.150.15
\(X=3\)0.170.33

Method: test the full table, including the cell that happens to match. The row totals are \(P(X=1)=0.08+0.12=0.20\), \(P(X=2)=0.15+0.15=0.30\), and \(P(X=3)=0.17+0.33=0.50\). The column totals are \(P(Y=0)=0.08+0.15+0.17=0.40\) and \(P(Y=1)=0.12+0.15+0.33=0.60\). The table sums to \(0.20+0.30+0.50=1.00\).

For the first row, the products are \(0.20(0.40)=0.08\) and \(0.20(0.60)=0.12\), so both cells in that row match. But for the cell \(X=2,Y=0\), the product is \(0.30(0.40)=0.12\), while the joint probability is \(0.15\). The mismatch \(0.12\ne0.15\) is enough to conclude that \(X\) and \(Y\) are dependent.

The full set of product values, by row, is \((0.08,0.12)\), \((0.12,0.18)\), and \((0.20,0.30)\). Only the first row matches the joint entries \((0.08,0.12)\), \((0.15,0.15)\), and \((0.17,0.33)\). Thus even two matching cells do not establish independence.

Common mistake avoided: Do not stop after finding a matching cell or row. Independence is a condition on every pair of outcomes, not a majority vote among cells.

Worked Example: Converting Counts and Handling a Zero-Probability Outcome

A hypothetical experiment records the following counts for discrete outcomes \(X\) and \(Y\). Treat the counts as the complete probability model for the experiment and determine whether the variables are independent.

\(Y=A\)\(Y=B\)\(Y=C\)Row total
\(X=0\)69015
\(X=1\)2305
Column total812020

Method: normalize counts to probabilities, then compare cells. The total count is \(20\). The row probabilities are \(P(X=0)=15/20=0.75\) and \(P(X=1)=5/20=0.25\). The column probabilities are \(P(Y=A)=8/20=0.40\), \(P(Y=B)=12/20=0.60\), and \(P(Y=C)=0/20=0\).

For \(X=0\), the marginal-product probabilities are \(0.75(0.40)=0.30\), \(0.75(0.60)=0.45\), and \(0.75(0)=0\). The actual joint probabilities in that row are \(6/20=0.30\), \(9/20=0.45\), and \(0/20=0\). For \(X=1\), the products are \(0.25(0.40)=0.10\), \(0.25(0.60)=0.15\), and \(0.25(0)=0\). The joint probabilities are \(2/20=0.10\), \(3/20=0.15\), and \(0/20=0\). Every cell agrees with its product, so \(X\) and \(Y\) are independent.

The zero-probability outcome \(Y=C\) causes no exception: each cell in that column has joint probability zero, matching its row probability multiplied by \(P(Y=C)=0\). It contributes no evidence about how \(X\) behaves when \(Y=C\), because that outcome never occurs, but the required equality still holds.

Common mistake avoided: Counts cannot be compared directly with probability products. Convert the joint counts and margins to probabilities—or consistently compare observed counts with their expected counts under the product rule. Here, dividing by the common total gives the probability comparison explicitly.

Reading the Result Correctly

A cell with joint probability zero deserves attention. If both corresponding marginal probabilities are positive, independence would require their product to be positive as well. A zero joint probability in that situation immediately disproves independence. By contrast, if an entire row or column has marginal probability zero, every cell in it must be zero, and the product test automatically agrees there. The remaining positive-probability rows and columns still need to be checked.

A useful way to organize a solution is to add row and column totals to the displayed table, then compute the expected product value for each cell. Keep the actual joint probabilities visible beside those products. This makes a mismatch easy to identify and prevents an unsupported conclusion based on only one pair of outcomes.

When a table is given as counts from a hypothetical complete finite model, normalization is essential for interpreting each entry as a probability. If the counts are merely observations from a sample, matching sample proportions to products is not by itself a general proof that the underlying random variables are independent. The table test taught here applies to the specified discrete probability distribution.

This cell-by-cell method is aligned with the SOA Exam P (Probability) syllabus. The central exam habit is straightforward: calculate the margins accurately, multiply the appropriate pair of margins for each cell, and state the conclusion based on whether all equalities hold.

Key takeaway: In a discrete joint probability table, independence holds exactly when every cell equals its row total multiplied by its column total. One unequal cell proves dependence; checking only one or a few cells cannot prove independence.

Check Your Understanding

For each table, find the needed marginals and use the cell-product rule. Treat all displayed tables as probability models unless the question specifies counts.

  1. A joint table has rows \(X=0,1\) and columns \(Y=A,B\), with rows \((0.14,0.56)\) and \((0.06,0.24)\). Find the margins and decide whether \(X\) and \(Y\) are independent. (Answer: row totals \(0.70,0.30\), column totals \(0.20,0.80\); independent.)
  2. A table has rows \(X=1,2,3\) and columns \(Y=0,1\), with rows \((0.10,0.15)\), \((0.20,0.05)\), and \((0.10,0.40)\). Find the margins and test independence. (Answer: row totals \(0.25,0.25,0.50\), column totals \(0.40,0.60\); dependent, since for example \(P(X=2,Y=0)=0.20\ne0.25(0.40)=0.10\).)
  3. A complete experiment gives counts by row \((6,9,0)\) and \((2,3,0)\), with columns \(Y=A,B,C\). Convert to probabilities and test independence. (Answer: total \(20\); row probabilities \(0.75,0.25\), column probabilities \(0.40,0.60,0\); independent.)
  4. A probability table has rows \(X=1,2,3\), columns \(Y=A,B\), and entries \((0.12,0.08)\), \((0.18,0.12)\), and \((0.20,0.30)\). Calculate the margins and decide whether one matching cell, if present, would be sufficient. (Answer: row totals \(0.20,0.30,0.50\), column totals \(0.50,0.50\); dependent, since \(P(X=1,Y=A)=0.12\ne0.20(0.50)=0.10\); one matching cell would not suffice.)
  5. A discrete probability table has \(P(X=0)=0.60\), \(P(X=1)=0.40\), and \(P(Y=A)=0.25\), \(P(Y=B)=0.75\). Its joint entries are \((0.15,0.45)\) in the \(X=0\) row and \((0.10,0.30)\) in the \(X=1\) row. Verify all four cells and state the result. (Answer: the four products are \(0.15,0.45,0.10,0.30\), respectively; independent.)
Clinical Biostats