Statistics & Probability · Grades 8, 9

Two-Way Tables: Finding Patterns in Categorical Data

Quick answer

A two-way table sorts data by two categories at once, with the totals along the edges. Raw counts alone rarely answer the question, because unequal group sizes distort the comparison. Converting each row to percentages of its own total puts the groups on equal footing, and a difference that survives that is evidence of a real association.

What you'll learn

  • Build and read a two-way frequency table
  • Calculate relative frequencies by row or column
  • Decide whether two categorical variables are associated
  • Name and compute joint, marginal and conditional relative frequencies

Sorting by two categories at once

A two-way frequency table counts how many fall into each combination of two categories.

Students asked whether they play a sport and whether they play an instrument:

InstrumentNo instrumentTotal
Sport303050508080
No sport454525257070
Total75757575150150

Each inner cell is one combination. The edges hold the marginal totals, and the corner holds the grand total.

Two checks worth running before anything else:

  • each row’s cells add to its row total: 30+50=8030 + 50 = 80 ✓
  • the row totals and column totals both add to 150150 ✓

If either fails, the table is wrong and nothing computed from it will be right.

Reading a cell

Every inner cell answers a “both” question.

QuestionCellAnswer
Play sport and instrument?top left3030
Play sport, no instrument?top right5050
Play neither?bottom right2525
Play sport at all?row total8080

Why raw counts mislead

Do sporty students play instruments less often?

Comparing the two “instrument” counts directly: 3030 against 4545. It looks like sporty students play instruments less.

But the two groups are not the same size — 8080 against 7070 — so the counts are not comparable. Convert each row to percentages of its own total:

InstrumentNo instrument
Sport30/80=37.5%30/80 = 37.5\%62.5%62.5\%
No sport45/70=64.3%45/70 = 64.3\%35.7%35.7\%

Now the comparison is fair, and the gap is larger than the raw counts suggested: 37.5%37.5\% against 64.3%64.3\%.

Dividing each row by its own total is what puts unequal groups on equal footing. It is the same reasoning as a unit rate: reduce both to a common basis, then compare.

Deciding whether there is an association

Two categories are associated when knowing one changes what you would expect of the other.

The test is whether the row percentages differ:

  • Similar rows — no association. Knowing whether a student plays sport tells you nothing about the instrument.
  • Different rows — association. Here 37.5%37.5\% against 64.3%64.3\% is a substantial gap, so the two are associated.

Compare against a table with no association:

InstrumentNo instrument
Sport50%50\%50%50\%
No sport52%52\%48%48\%

Near-identical rows mean the categories are close to independent.

Row or column percentages

Which you compute depends on the question.

QuestionDivide by
Of sporty students, how many play an instrument?the row total
Of instrument players, how many play sport?the column total

These give different numbers and answer different questions:

3080=37.5%3075=40%\frac{30}{80} = 37.5\% \qquad \frac{30}{75} = 40\%

Same cell, two denominators. Read the question to see which group is being asked about, and divide by that group’s total.

The three kinds of relative frequency

Every relative frequency in a two-way table is one count divided by another. Which two counts decides its name.

KindDivideAnswers
jointa cell by the grand totalwhat share of everyone is in both groups
marginala row or column total by the grand totalwhat share of everyone is in one group
conditionala cell by its row or column totalwithin one group, what share is in the other

Using the sport and instrument table, with 150150 students in all:

joint: 30150=20%marginal: 80150≈53.3%conditional: 3080=37.5%\text{joint: } \frac{30}{150} = 20\% \qquad \text{marginal: } \frac{80}{150} \approx 53.3\% \qquad \text{conditional: } \frac{30}{80} = 37.5\%

The denominator names the kind. Divide by the grand total and you get a joint or marginal frequency. Divide by a row or column total and you get a conditional one.

Dividing every cell by the grand total gives a whole table of joint relative frequencies, with the marginal ones along its edges:

InstrumentNo instrumentTotal
Sport20%20\%33.3%33.3\%53.3%53.3\%
No sport30%30\%16.7%16.7\%46.7%46.7\%
Total50%50\%50%50\%100%100\%

The whole table adds to 100%100\%, which is the same check as before in a new unit.

Association is judged with conditional frequencies. Joint frequencies mix up two things at once — how common a combination is and how big each group is — so comparing them repeats the raw-count problem from earlier.

Why association is not cause

A table can show two categories occurring together more often than chance would suggest. It cannot show that one produces the other.

Sport and instrument playing are associated here, and nothing in the table says which way round — or whether some third thing, such as how much free time a student has, drives both.

That limit is not a flaw in the method. It is what the method measures: a two-way table records how often things co-occur, and co-occurrence is not causation.

Worked examples

Common mistakes

Practice problems

Use this table for questions 1 to 6.

BusWalkTotal
Grade 740406060100100
Grade 875752525100100
Total1151158585200200
  1. How many Grade 7 students walk?

    Answer

    6060

    Full solution

    The cell where the Grade 7 row meets the Walk column.

  2. How many students take the bus in total?

    Answer

    115115

    Full solution

    The Bus column total.

  3. How many students are there altogether?

    Answer

    200200

    Full solution

    The grand total in the corner, which matches 100+100100 + 100 and 115+85115 + 85.

  4. What percentage of Grade 7 take the bus?

    Answer

    40%40\%

    Full solution

    40100=40%\tfrac{40}{100} = 40\%, using the Grade 7 row total.

  5. What percentage of Grade 8 take the bus?

    Answer

    75%75\%

    Full solution

    75100=75%\tfrac{75}{100} = 75\%.

  6. Is grade level associated with how students travel?

    Answer

    Yes

    Full solution

    40%40\% against 75%75\% is a large gap, so knowing the grade level changes what you would expect.

  7. A row total is 9090 and one cell is 3434. Find the other cell.

    Answer

    5656

    Full solution

    90−34=5690 - 34 = 56.

  8. Of the 115115 bus users above, what percentage are in Grade 8?

    Hint

    Which total does the question name?

    Answer

    About 65%65\%

    Full solution

    The question is about bus users, so divide by the column total: 75115≈65.2%\tfrac{75}{115} \approx 65.2\%.

  9. Two rows give 46%46\% and 44%44\% for the same category. Is there an association?

    Answer

    No meaningful one

    Full solution

    The rows differ by two points, so knowing which group a member is in barely changes the expectation.

  10. Two groups of 4040 and 200200 both have 2020 members choosing an option. Sam says the option is equally popular in both. Assess his claim.

    Hint

    What fraction of each group is that?

    Answer

    No. It is 50%50\% of the first group and 10%10\% of the second.

    Full solution

    The counts match, and the groups do not.

    2040=50%\tfrac{20}{40} = 50\% against 20200=10%\tfrac{20}{200} = 10\%.

    So the option is five times as popular in the smaller group. Equal counts across unequal groups is exactly the situation relative frequencies exist to handle — and comparing raw counts here reverses the true picture rather than merely blurring it.

  11. A survey of 200200 students finds 100100 in Grade 8, of whom 2525 walk to school. Find the joint relative frequency of “Grade 8 and walks”, and the conditional relative frequency of walking among Grade 8 students.

    Hint

    The two answers use different denominators.

    Answer

    Joint 12.5%12.5\%; conditional 25%25\%

    Full solution

    A joint relative frequency divides the cell by the grand total: 25200=12.5%\tfrac{25}{200} = 12.5\% of all students are in Grade 8 and walk.

    A conditional relative frequency divides the same cell by its own group’s total: 25100=25%\tfrac{25}{100} = 25\% of Grade 8 students walk.

    Same cell, two denominators, two different questions answered.

Frequently asked questions

What is a two-way table?

A table sorting data by two categories at once, with row and column totals along the edges.

What is a relative frequency?

A count expressed as a fraction or percentage of a total, which lets groups of different sizes be compared fairly.

Should I use row or column percentages?

Whichever matches the question. To compare groups defined by the rows, convert each row to percentages of its own row total.

What does association mean here?

That knowing one category changes what you would expect of the other. If the row percentages differ noticeably, the two are associated.

Does association prove one thing causes the other?

No. A two-way table can show that two categories occur together more often than chance would suggest, and that alone never establishes cause.

What to learn next

Standards alignment

This lesson covers the following Common Core State Standards for Mathematics.

  • CCSS.MATH.CONTENT.8.SP.A.4Statistics and ProbabilityUnderstand that patterns of association can also be seen in bivariate categorical data by displaying frequencies and relative frequencies in a two-way table. Construct and interpret a two-way table summarizing data on two categorical variables collected from the same subjects. Use relative frequencies calculated for rows or columns to describe possible association between the two variables.
  • CCSS.MATH.CONTENT.HSS.ID.B.5Interpreting Categorical and Quantitative DataSummarize categorical data for two categories in two-way frequency tables. Interpret relative frequencies in the context of the data (including joint, marginal, and conditional relative frequencies). Recognize possible associations and trends in the data.