Tutorials › Introduction to Statistics › Worked Workshop on Association and Simpson’s Paradox

Two-Way Tables and Association · Tutorial 224 of 996

Worked Workshop on Association and Simpson's Paradox

Practice reading a complete categorical data set from its counts through its subgroup comparisons, including a carefully checked Simpson’s paradox reversal.

Beginner 12 min read

What You'll Learn

  • Organize outcome counts into a pooled two-way table and subgroup tables.
  • Calculate joint, marginal, and conditional proportions using the correct denominators.
  • Compare conditional outcome proportions within each stratum.
  • Show how different subgroup weights can reverse a pooled comparison.
  • Explain a reversal without treating a descriptive association as proof of causation.

A Complete Table Tells More Than One Story

A two-way table can summarize the same categorical data in several useful ways. The counts show how many observations fall into each combination of categories; proportions describe shares of the whole data set, shares of a row or column, or shares within a subgroup. These are different summaries, and their denominators answer different questions.

This workshop follows one hypothetical treatment comparison from its stratified counts to its pooled table. The data are deliberately arranged so that Treatment A has a higher success proportion than Treatment B in each severity group, while its pooled success proportion is lower. The calculation will show exactly how both statements can be true.

Definition: A joint proportion is the count in one cell divided by the total number of observations. A marginal proportion is a row or column total divided by the overall total. A conditional proportion is a cell count divided by the total for the specified condition, such as a row total when conditioning on the row category. Always identify the denominator before interpreting a proportion.

Worked Example: Build the Pooled and Stratified Tables

Worked Example: Build the Pooled and Stratified Tables

Suppose a hypothetical clinic records success or failure for patients receiving Treatment A or Treatment B. Patients are also classified as having lower or higher initial severity. These invented counts are for practicing table analysis; they do not represent real treatment evidence.

The lower-severity counts are: for Treatment A, 81 successes and 6 failures; for Treatment B, 234 successes and 36 failures. The higher-severity counts are: for Treatment A, 192 successes and 108 failures; for Treatment B, 18 successes and 12 failures.

First check the row totals. In the lower-severity group, Treatment A has \(81+6=87\) patients and Treatment B has \(234+36=270\). In the higher-severity group, the corresponding totals are \(192+108=300\) and \(18+12=30\).

The stratified tables preserve the severity information:

Lower severitySuccessFailureTotal
Treatment A81687
Treatment B23436270
Total31542357
Higher severitySuccessFailureTotal
Treatment A192108300
Treatment B181230
Total210120330

Add corresponding cells across severity groups to obtain the pooled table. Treatment A has \(81+192=273\) successes and \(6+108=114\) failures, for a total of 387. Treatment B has \(234+18=252\) successes and \(36+12=48\) failures, for a total of 300. The full sample size is \(357+330=687\).

All severity levelsSuccessFailureTotal
Treatment A273114387
Treatment B25248300
Total525162687

The totals provide a useful arithmetic check: \(273+114=387\), \(252+48=300\), and \(387+300=687\). The outcome column totals also agree: \(273+252=525\) successes and \(114+48=162\) failures.

Worked Example: Joint, Marginal, and Conditional Proportions

Worked Example: Joint, Marginal, and Conditional Proportions

Use the pooled table to calculate three kinds of proportions. The denominator changes with the question, so write it explicitly.

Joint proportion. The proportion of all 687 patients who received Treatment A and succeeded is the A-success cell divided by the grand total:

$$ \frac{273}{687}=0.3974 $$

Thus about 39.74% of all patients in this hypothetical data set were in the Treatment A-and-success cell. This is not the success rate among Treatment A patients; its denominator is all patients.

Marginal proportion. The proportion of all patients who received Treatment A is the A row total divided by 687:

$$ \frac{387}{687}=0.5633 $$

So 56.33% of the patients received Treatment A. The marginal success proportion is \(525/687=0.7642\), or 76.42% of all patients.

Conditional proportion. The pooled success proportion among Treatment A patients is the number of A successes divided by the A row total:

$$ \frac{273}{387}=0.7054 $$

The pooled success proportion for Treatment B is calculated with the B row total as denominator:

$$ \frac{252}{300}=0.8400 $$

The pooled comparison therefore favors Treatment B by \(0.8400-0.7054=0.1346\), or about 13.46 percentage points. That comparison describes the pooled data. It does not yet tell us what the comparison looks like within each severity group.

Compare Within Each Severity Group

To make a within-group comparison, divide each success count by the treatment total in that same severity group. The lower-severity success proportions are \(81/87\) for Treatment A and \(234/270\) for Treatment B. The higher-severity proportions are \(192/300\) and \(18/30\), respectively.

$$ \begin{aligned} \text{Lower severity:}\quad &\frac{81}{87}=0.9310,\qquad \frac{234}{270}=0.8667,\\ \text{A minus B:}\quad &\frac{81}{87}-\frac{234}{270} =\frac{28}{435}\approx 0.0644;\\[4pt] \text{Higher severity:}\quad &\frac{192}{300}=0.6400,\qquad \frac{18}{30}=0.6000,\\ \text{A minus B:}\quad &\frac{192}{300}-\frac{18}{30}=0.0400. \end{aligned} $$

Within lower severity, the success proportion is higher for Treatment A by about 0.0644, or 6.44 percentage points. This difference comes from the original fractions: \(81/87-234/270\). Subtracting the separately rounded displayed proportions can produce a slightly different last digit. Within higher severity, Treatment A’s success proportion is higher by 0.0400, or 4.00 percentage points.

The within-group comparisons and the pooled comparison have opposite directions: A’s success proportion is higher in both severity groups, but B’s is higher in the pooled table. This is a form of Simpson’s paradox: an association seen in separate groups reverses when those groups are combined.

Why the Pooled Comparison Reverses

The pooled success proportion for a treatment is a weighted average of that treatment’s subgroup success proportions. The weights are the proportions of that treatment’s patients who belong to each severity group. The weights can differ between treatments, and in this data set they differ substantially.

Result: If the strata are indexed by \(j\), then for a treatment group \(T\), \(P(\text{success}\mid T)=\sum_j P(\text{success}\mid T,\text{stratum }j)P(\text{stratum }j\mid T)\). The subgroup success proportions are weighted by the severity distribution within that treatment group.

Here, 300 of 387 Treatment A patients are in the higher-severity group, whereas only 30 of 300 Treatment B patients are. The weighted-average calculations recover the pooled proportions exactly:

$$ \begin{aligned} P(\text{success}\mid A) &=\frac{87}{387}\left(\frac{81}{87}\right) +\frac{300}{387}\left(\frac{192}{300}\right) =\frac{273}{387}=0.7054,\\ P(\text{success}\mid B) &=\frac{270}{300}\left(\frac{234}{270}\right) +\frac{30}{300}\left(\frac{18}{30}\right) =\frac{252}{300}=0.8400. \end{aligned} $$

A Short Justification of the Weighted-Average Formula

The formula follows by splitting the event “success and treatment T” into disjoint cases according to stratum. For two strata, every success in group \(T\) is either a success in stratum 1 or a success in stratum 2. Dividing the sum of those two counts by the total number in \(T\) gives:

$$ \begin{aligned} P(\text{success}\mid T) &=\frac{n_{T,1,\text{success}}+n_{T,2,\text{success}}}{n_T}\\ &=\frac{n_{T,1}}{n_T} \frac{n_{T,1,\text{success}}}{n_{T,1}} +\frac{n_{T,2}}{n_T} \frac{n_{T,2,\text{success}}}{n_{T,2}}\\ &=P(\text{stratum }1\mid T)P(\text{success}\mid T,\text{stratum }1) +P(\text{stratum }2\mid T)P(\text{success}\mid T,\text{stratum }2). \end{aligned} $$

The weights are nonnegative and sum to one because \(n_{T,1}/n_T+n_{T,2}/n_T=1\). Consequently, the pooled proportion lies between the two subgroup proportions for that treatment. But if the treatment groups have different weights, their pooled proportions need not preserve the direction of the within-stratum comparisons. In this example, the A group contains a much larger share of higher-severity patients, whose success proportions are lower for both treatments.

Worked Example: Diagnose a Reversal in a New Table

Worked Example: Diagnose a Reversal in a New Table

Consider another invented data set, this time about applications accepted in two departments. In Department 1, Group X has 9 acceptances among 10 applicants and Group Y has 80 among 100. In Department 2, Group X has 30 acceptances among 100 applicants and Group Y has 1 among 5.

Within Department 1, the acceptance proportions are \(9/10=0.9000\) for X and \(80/100=0.8000\) for Y, so X is higher by 10 percentage points. Within Department 2, they are \(30/100=0.3000\) for X and \(1/5=0.2000\) for Y, so X is again higher by 10 percentage points.

Pool the department counts. Group X has \(9+30=39\) acceptances among \(10+100=110\) applicants, giving \(39/110=0.3545\). Group Y has \(80+1=81\) acceptances among \(100+5=105\), giving \(81/105=0.7714\). The pooled comparison favors Y even though X has the higher acceptance proportion in each department.

The table reveals the differing mix: most X applicants are in Department 2, where acceptance proportions are lower for both groups; most Y applicants are in Department 1. The pooled comparison is therefore strongly affected by how applicants are distributed across departments. The descriptive table alone does not establish why those distributions differ or support a causal conclusion about group membership.

Reading and Reporting the Pattern Carefully

When a pooled comparison and subgroup comparisons disagree, report both rather than choosing whichever supports a preferred conclusion. Identify the outcome category, state which proportion is in the numerator and which group forms the denominator, and name the strata. For the clinic example, a clear summary is: “Treatment A had a higher success proportion in each severity group, but Treatment B had a higher success proportion in the pooled data. Treatment A’s patients were much more concentrated in the higher-severity group.”

This is a descriptive statement about the table. A reversal can signal that the grouping variable is important to understanding the observed association, but it does not by itself show that severity caused the reversal or establish which treatment is more effective. In particular, do not turn a pattern in hypothetical or observational counts into a causal claim.

Common Mistake

  • Wrong reasoning: “Treatment A is better overall because its success proportion is higher in both severity groups.” This ignores the pooled data and treats the subgroup comparisons as if they automatically determine the pooled comparison.
  • Correction: Report the subgroup and pooled proportions separately. In this example, A is higher within both strata, while B is higher overall. Explain that the groups have different severity mixes and that pooling uses different weights.
  • Another denominator error: Calling \(273/687\) the success rate for Treatment A. That is the joint proportion of all patients who received A and succeeded. The conditional success proportion among A patients is \(273/387\).
Key takeaway: A complete analysis keeps counts, denominators, and grouping variables visible. Joint, marginal, and conditional proportions answer different questions; stratified and pooled comparisons can differ because their subgroup weights differ.

Check Your Understanding

Use the tables and reasoning in this tutorial to answer the following questions.

  1. In the pooled clinic table, what does \(48/300\) represent, and what does \(48/687\) represent?
  2. Calculate the higher-severity failure proportion for Treatment A. State its denominator and interpret it in context.
  3. Why is \(81/87-234/270\) the appropriate lower-severity comparison, rather than comparing either success count directly?
  4. What are the proportions of Treatment A patients in the lower- and higher-severity groups? Do they sum to one?
  5. Explain how Treatment A can have a higher success proportion within each severity group but a lower pooled success proportion.