Tutorials › Introduction to Statistics › Stratifying a Two-Way Table

Two-Way Tables and Association · Tutorial 216 of 996

Stratifying a Two-Way Table

Organize a three-way categorical table into strata and make clear, like-for-like comparisons of outcome proportions within each stratum.

Beginner 9 min read

What You'll Learn

  • Identify the grouping variable used to define strata in a three-variable data set.
  • Build a separate two-way frequency table for each stratum.
  • Calculate an outcome proportion using the relevant group total as its denominator.
  • Compare the same outcome and groups within every stratum.
  • Describe the limits of a stratified comparison without making causal claims.

Why Stratify a Two-Way Table?

A two-way table describes the relationship between two categorical variables. Sometimes a third categorical variable is also relevant to how the data are organized. For example, we might compare treatment group and outcome separately for patients in different severity categories. Stratifying means dividing the records into groups defined by that third variable and constructing a separate two-way table within each group.

The purpose is to make like-for-like comparisons. Instead of comparing treatment groups while ignoring severity, we compare them among patients in the same severity category. This does not, by itself, establish why outcomes differ or whether a treatment caused a difference. It is a way to organize and describe the observed data.

Definition: A stratified two-way table is a collection of two-way tables formed from a three-variable categorical data set. Each table includes the same two variables, while a third categorical variable determines which records belong in that table. One value or category of the third variable defines one stratum.

Constructing and Reading the Strata

Suppose the three variables are group, outcome, and stratum. First choose which variable will define the strata. Then, for each of its categories, count the records in every group-and-outcome combination. Include row and column totals so that the denominators for proportions are visible. The tables should use the same group and outcome categories in every stratum, even if some counts happen to be zero.

For comparing outcome proportions between groups, the denominator is the total number of records in the particular group and stratum being described. If \(a_z\) records in group A and stratum \(z\) have the outcome of interest, and \(n_{A,z}\) records are in that group and stratum altogether, then the proportion with the outcome is:

$$ \text{Proportion with outcome in group A, stratum } z = \frac{a_z}{n_{A,z}}. $$

The same rule applies to group B or any other group: use that group's total within the same stratum. This gives a conditional proportion, describing the outcome distribution among records in a specified group and stratum. When comparing groups, keep the outcome, stratum, and denominator definition consistent.

A descriptive stratification requires no probability model or inference procedure. It does require that each record be assigned to the intended category for each variable, that the categories be clearly defined, and that counts refer to distinct records. If data are missing, state how those records are handled rather than silently treating missing values as a category or including them in an unclear denominator.

1
Name the variables.
Identify the two variables for each table and the third categorical variable that defines the strata.
2
Make one table per stratum.
Count each group-and-outcome combination within that stratum, then show the corresponding totals.
3
Calculate within-stratum proportions.
For each group, divide the number with the outcome by that group's total in that stratum.
4
Compare matching quantities.
Compare the same outcome for the same groups within each stratum, and report the stratum and units.

Worked Comparisons Within Strata

Worked Example: Comparing Outcomes by Patient Severity

Hypothetical data: A clinic records treatment group, whether a patient improved, and initial severity. The table below shows the counts. Each row represents patients in a group within the displayed severity stratum.

Mild severity

GroupImprovedDid not improveTotal
Treatment A181230
Treatment B121830

Severe severity

GroupImprovedDid not improveTotal
Treatment A83240
Treatment B41620

Among patients with mild severity, the improvement proportion is \(18/30\) for Treatment A and \(12/30\) for Treatment B:

$$ \frac{18}{30}=0.600=60.0\%, \qquad \frac{12}{30}=0.400=40.0\%. $$

Within the mild-severity stratum, the observed improvement proportion is 20.0 percentage points higher for Treatment A than for Treatment B. The percentage-point difference is \(60.0\%-40.0\%=20.0\) percentage points.

Among patients with severe severity, the corresponding calculations are:

$$ \frac{8}{40}=0.200=20.0\%, \qquad \frac{4}{20}=0.200=20.0\%. $$

Within the severe-severity stratum, both groups have an observed improvement proportion of 20.0%, so their within-stratum difference is 0.0 percentage points. These are descriptive comparisons of the patients represented in each stratum; they do not show that treatment group caused the outcomes.

Worked Example: Comparing Groups Across Three Experience Strata

Hypothetical data: A training program records whether participants completed a course, whether they received text or letter reminders, and their previous experience level. Calculate the completion proportion for each reminder group separately at each experience level.

Low experience

ReminderCompletedDid not completeTotal
Text241640
Letter151530

For low-experience participants, the proportions completing are \(24/40=0.600=60.0\%\) with text reminders and \(15/30=0.500=50.0\%\) with letter reminders. The within-stratum difference is 10.0 percentage points in favor of the text group.

Medium experience

ReminderCompletedDid not completeTotal
Text301040
Letter24832

For medium-experience participants, the proportions are \(30/40=0.750=75.0\%\) and \(24/32=0.750=75.0\%\), respectively. The observed within-stratum difference is 0.0 percentage points.

High experience

ReminderCompletedDid not completeTotal
Text18220
Letter18220

For high-experience participants, both proportions are \(18/20=0.900=90.0\%\), giving a difference of 0.0 percentage points. The complete stratified description is therefore: the text group has a higher observed completion proportion in the low-experience stratum, and the proportions are equal in the medium- and high-experience strata. The comparison is made within each experience category, not between one group's proportion in one stratum and the other group's proportion in another.

Worked Example: Comparing a Multi-Category Outcome

Hypothetical data: Two hospital wards record each patient's care group and discharge status: recovered, unchanged, or worsened. Ward is the stratum. Because the outcome has three categories, compare the within-group proportions for each outcome category, not only the recovered counts.

Ward 1

Care groupRecoveredUnchangedWorsenedTotal
Group A188430
Group B1510530

For Group A in Ward 1, the proportions are \(18/30=60.0\%\) recovered, \(8/30=26.7\%\) unchanged, and \(4/30=13.3\%\) worsened. For Group B, they are \(15/30=50.0\%\), \(10/30=33.3\%\), and \(5/30=16.7\%\), respectively. Thus, within Ward 1, the recovered proportion is 10.0 percentage points higher in Group A, while the unchanged and worsened proportions are each lower.

Ward 2

Care groupRecoveredUnchangedWorsenedTotal
Group A126220
Group B144220

For Group A in Ward 2, the proportions are \(12/20=60.0\%\) recovered, \(6/20=30.0\%\) unchanged, and \(2/20=10.0\%\) worsened. For Group B, they are \(14/20=70.0\%\), \(4/20=20.0\%\), and \(2/20=10.0\%\). Within Ward 2, the recovered proportion is 10.0 percentage points higher in Group B. In each group and stratum, the three outcome proportions sum to 100%, apart from rounding. The comparison is descriptive and does not attribute the differences to care group.

Why the Denominator Matters

A within-stratum proportion answers a specific question: among records in this group and this stratum, what fraction had the outcome? The corresponding denominator is the total for that group within that stratum. For example, the 60.0% completion proportion for text reminders among low-experience participants uses 40 as its denominator, not the total number of participants across all experience levels.

The calculation can be justified directly from the table structure. Within a fixed stratum, the group total is divided into mutually exclusive outcome categories. For a binary outcome, the group total is the sum of the counts with and without the outcome. Therefore, dividing the count with the outcome by that group total gives the fraction of that group in that stratum with the outcome:

$$ \frac{\text{count with outcome}} {\text{count with outcome}+\text{count without outcome}} = \text{within-group, within-stratum outcome proportion}. $$

This is why a cell count alone is not a proportion and why a count from one stratum cannot be interpreted using another stratum's total. To compare groups fairly within a stratum, calculate each group's proportion from its own row total, then compare those proportions for the same outcome.

Common Mistakes and a Careful Interpretation

  • Using the entire data set as the denominator. This does not give the proportion within a stratum. Use the relevant group's total inside that stratum.
  • Comparing counts instead of proportions. A larger count may simply reflect a larger group. Calculate proportions before comparing outcome rates when group sizes differ.
  • Changing the comparison between strata. Keep the same outcome and group ordering in every table so the comparisons have a consistent meaning.
  • Claiming causation from a table. A difference in observed proportions describes the data. It does not, on its own, establish that the group difference caused the outcome difference.

A clear report names the groups, the outcome, the stratum, and the proportions being compared. For example: “Among low-experience participants, 60.0% of those receiving text reminders completed the course, compared with 50.0% of those receiving letter reminders, a difference of 10.0 percentage points.” This statement identifies the denominator groups and does not overstate what the table can establish.

Check Your Understanding

For each question, identify the relevant stratum and denominator before calculating or interpreting a proportion.

  1. A table separates participants by age category, then lists group and outcome counts. Which variable defines the strata, and what should be held constant when comparing groups?
  2. In one stratum, 16 of 25 members of Group A have the outcome. Write the proportion and interpret it in context-free terms.
  3. Why is it incorrect to divide an outcome count from one group and stratum by the total number of records in the entire data set when reporting a within-stratum proportion?
  4. Two groups have different counts with an outcome, but also different group totals within a stratum. What should you calculate to make a descriptive comparison?
  5. If the outcome has three categories, what should the within-group proportions across those categories sum to, before rounding?