Why Read Tables Within Strata?
A contingency table records how often combinations of categorical values occur. When the table is stratified by a third variable, the question is whether two variables are independent within each stratum. For example, a researcher might ask whether treatment assignment \(X\) and an outcome \(Y\) are independent among patients at each clinic \(Z=z\). The answer must be assessed separately in the clinic-specific tables; comparing only totals can conceal how the joint distribution behaves within a stratum.
The earlier material on conditional independence gives the general factorization definition. Here we make that definition operational for finite tables: identify the relevant conditional cell probabilities, compare them with products of their conditional margins, and use equivalent probability or cross-product checks.
Write \(p_{ij\mid z}=P(X=x_i,Y=y_j\mid Z=z)\), \(p_{i+\mid z}=P(X=x_i\mid Z=z)\), and \(p_{+j\mid z}=P(Y=y_j\mid Z=z)\). The plus sign indicates that probabilities have been summed over that index. Conditional independence says that every cell in a stratum equals the product of its row and column margins:
For a count table in stratum \(z\), let \(n_{ijz}\) be the cell count, \(n_{i+z}=\sum_j n_{ijz}\) the row total, \(n_{+jz}=\sum_i n_{ijz}\) the column total, and \(n_{++z}=\sum_i\sum_j n_{ijz}\) the stratum total. The corresponding empirical conditional probabilities are the cell and margin counts divided by \(n_{++z}\). Thus the empirical factorization condition can also be written as
The quantity on the right is the cell count implied by independence for the observed margins. A count table can be checked exactly this way, though observed counts from a random sample will not generally match those quantities exactly. Exact equality describes the table’s empirical distribution; it is not, by itself, an inferential test of a population model.
Equivalent Checks Within a Stratum
It is often easier to compare conditional probabilities than to calculate every product of margins. If independence holds, the distribution of \(X\) given \(Y=y\) and \(Z=z\) must equal the distribution of \(X\) given \(Z=z\), whenever the conditioning event has positive probability. The same statement holds with \(X\) and \(Y\) exchanged.
Proof. Fix a stratum \(z\) with positive probability. If the factorization holds and \(P(Y=y\mid Z=z)>0\), then
Conversely, suppose the conditional-probability equality holds for every \(y\) with positive conditional probability. For such \(y\), the multiplication rule gives
If instead \(P(Y=y\mid Z=z)=0\), then \(P(X=x,Y=y\mid Z=z)=0\) for every \(x\), so the same factorization holds because its right side is also zero. This proves the factorization for all \(x,y\) in the stratum, and hence conditional independence. Interchanging \(X\) and \(Y\) proves the other version. \(\square\)
For a two-by-two table, a further shortcut is available. Label its conditional cell probabilities \(p_{11},p_{12},p_{21},p_{22}\), omitting \(z\) temporarily. Independence requires
For a table with more rows or columns, the corresponding check is that every two-by-two minor is zero.
Proof. If the table factors, then \(p_{ij}p_{k\ell}=(p_{i+}p_{+j})(p_{k+}p_{+\ell})\), which equals \(p_{i\ell}p_{kj}\). For the converse, choose a cell \((r,s)\) with \(p_{rs}>0\); one exists because all entries are nonnegative and sum to one. The zero-minor condition gives
Set \(u_i=p_{is}\), \(v_j=p_{rj}\), \(U=\sum_i u_i\), and \(V=\sum_j v_j\). Summing \(p_{ij}=u_iv_j/p_{rs}\) over all \(i,j\) gives \(1=UV/p_{rs}\), so \(p_{rs}=UV\). Therefore \(p_{ij}=(u_i/U)(v_j/V)\). Summing this expression across a row gives \(p_{i+}=u_i/U\), and summing down a column gives \(p_{+j}=v_j/V\). Hence \(p_{ij}=p_{i+}p_{+j}\), as required. This argument permits zero cells. \(\square\)
Worked Table Checks
Worked Example: Independence in Each of Two Strata
Suppose a study records binary variables \(X\) and \(Y\) in two strata, \(Z=0\) and \(Z=1\). Rows give \(X=1,0\), and columns give \(Y=1,0\). The observed tables are:
| \(Z=0\) | \(Y=1\) | \(Y=0\) | Row total |
|---|---|---|---|
| \(X=1\) | 18 | 12 | 30 |
| \(X=0\) | 12 | 8 | 20 |
| Column total | 30 | 20 | 50 |
For \(Z=0\), the conditional cell proportion in the first cell is \(18/50=0.36\). Its product-of-margins value is \((30/50)(30/50)=0.36\). The other three cell proportions are \(12/50=0.24\), \(12/50=0.24\), and \(8/50=0.16\); the corresponding products are \(0.6(0.4)=0.24\), \(0.4(0.6)=0.24\), and \(0.4(0.4)=0.16\). Thus all four cells factor in this stratum.
| \(Z=1\) | \(Y=1\) | \(Y=0\) | Row total |
|---|---|---|---|
| \(X=1\) | 12 | 18 | 30 |
| \(X=0\) | 8 | 12 | 20 |
| Column total | 20 | 30 | 50 |
In \(Z=1\), the first cell proportion is \(12/50=0.24\), and its product of margins is \((30/50)(20/50)=0.24\). The remaining cell proportions are \(18/50=0.36\), \(8/50=0.16\), and \(12/50=0.24\); their products are \(0.6(0.6)=0.36\), \(0.4(0.4)=0.16\), and \(0.4(0.6)=0.24\). Independence holds in this stratum too, so these tables satisfy \(X\perp Y\mid Z\) empirically. Each stratum was checked separately.
Worked Example: Finding Dependence in One Stratum
Keep the \(Z=0\) table above, but suppose the \(Z=1\) table is:
| \(Z=1\) | \(Y=1\) | \(Y=0\) | Row total |
|---|---|---|---|
| \(X=1\) | 30 | 10 | 40 |
| \(X=0\) | 10 | 30 | 40 |
| Column total | 40 | 40 | 80 |
In this stratum, \(P(X=1\mid Z=1)=40/80=0.5\), whereas \(P(X=1\mid Y=1,Z=1)=30/40=0.75\). These are not equal, so the conditional-probability criterion rules out independence in \(Z=1\). The cell calculation confirms it: the observed top-left proportion is \(30/80=0.375\), but the product of its conditional margins is \(0.5(0.5)=0.25\). Equivalently, the two cross-products are \(30(30)=900\) and \(10(10)=100\), which are unequal. Since conditional independence must hold in every positive-probability stratum, it fails for this set of tables.
Worked Example: A Three-Category Variable
Within one stratum \(Z=z\), suppose \(X\) has categories \(A,B,C\), while \(Y\) is binary:
| Category of \(X\) | \(Y=1\) | \(Y=0\) | Row total |
|---|---|---|---|
| \(A\) | 6 | 4 | 10 |
| \(B\) | 9 | 6 | 15 |
| \(C\) | 3 | 2 | 5 |
| Column total | 18 | 12 | 30 |
The column proportion for \(Y=1\) is \(18/30=0.6\). Within each row, the proportion with \(Y=1\) is \(6/10=0.6\) for \(A\), \(9/15=0.6\) for \(B\), and \(3/5=0.6\) for \(C\). Thus the conditional distribution of \(Y\) is the same across all categories of \(X\). The cell products also check: for row \(A\), the independence counts are \(10(18)/30=6\) and \(10(12)/30=4\); for \(B\), they are \(15(18)/30=9\) and \(15(12)/30=6\); for \(C\), they are \(5(18)/30=3\) and \(5(12)/30=2\). Every cell factors, so \(X\) and \(Y\) are independent within this stratum.
A Reliable Diagnostic and Common Pitfalls
For a stratified table, a consistent check is to inspect every positive-total stratum, compute its conditional margins, and compare the cells with the products of those margins. Conditional probability comparisons can make the discrepancy especially clear; cross-products are a compact alternative for two-by-two tables. A zero cell does not invalidate these checks: use the factorization or minor equalities rather than dividing by that cell.
For each \(z\) with positive total, form the table of \(X\) by \(Y\). Do not combine counts across \(z\) for this conditional-independence check.
Compute each row total, column total, and stratum total, then divide by the stratum total if working with conditional probabilities.
Check whether every conditional cell probability equals its row-margin probability times its column-margin probability. Alternatively, compare conditional distributions or use two-by-two minors.
Conditional independence requires the factorization in every positive-probability stratum. A failure in even one stratum is enough to reject the factorization for the full conditional-independence claim.
A common mistake is to check whether \(P(X=x\mid Y=y,Z=z)\) is the same for different \(z\). That is not the within-stratum criterion: compare \(P(X=x\mid Y=y,Z=z)\) with \(P(X=x\mid Z=z)\) while holding the same \(z\) fixed. Conditional independence does not require the distribution of \(X\) to be identical across strata. Another mistake is to regard approximate agreement in a sample as proof of population independence. The exact calculations here diagnose a probability table—or describe an empirical table. Statistical evidence about a population requires an inferential procedure beyond exact table factorization.
Check Your Understanding
Use the stratum-specific definition and calculations to answer these questions.
- In a stratum with total \(40\), a cell count is \(12\), its row total is \(20\), and its column total is \(24\). Does that cell satisfy the empirical factorization condition?
- Why is it necessary to check every positive-probability stratum when assessing \(X\perp Y\mid Z\)?
- For a two-by-two table with cells \(a,b,c,d\) arranged by rows, what equality of cross-products is required for independence?
- If \(P(X=x\mid Y=y,Z=z)=P(X=x\mid Z=z)\) for all \(x\) and every \(y\) of positive conditional probability, what happens for a \(y\) with \(P(Y=y\mid Z=z)=0\)?
- Does an empirical table that factors exactly establish that the variables are independent in the population? Explain briefly.