Math Core

Lesson 10.3 · Data and Statistics

Two-way frequency tables

So far in this unit every data set has been numbers. But many questions are about categories: yes or no, grade level, favorite app. When you record two categorical variables for each person, a two-way table organizes the counts so you can ask whether the variables are related, for example whether students who play an instrument are more or less likely to play a sport.

Two-way frequency tables

A school surveyed 150150 students with two questions: Do you play a musical instrument? and Do you play a sport? Each student lands in exactly one of four cells.

Plays a sportNo sportTotal
Plays an instrument242436366060
No instrument545436369090
Total78787272150150

Definition

Joint and marginal frequencies

A joint frequency is a count in the body of the table: it counts people with one category from each variable. (2424 students play an instrument and a sport.)

A marginal frequency is a row or column total, written in the margins. It counts one variable alone. (7878 students play a sport.)

The grand total in the corner counts everyone.

The totals give a built-in check: each row adds across to its total, each column adds down to its total, and both the row totals and the column totals add to the grand total. Here 60+90=15060 + 90 = 150 and 78+72=15078 + 72 = 150.

Worked example: Completing a table

A movie theater surveyed 200200 customers about whether they bought popcorn. Complete the table.

PopcornNo popcornTotal
Adult4848110110
Child1818
Total200200

Work from any row or column that has only one blank.

  • Adults with no popcorn: 110−48=62110 - 48 = 62.
  • Children in total: 200−110=90200 - 110 = 90.
  • Children with popcorn: 90−18=7290 - 18 = 72.
  • Popcorn total: 48+72=12048 + 72 = 120. No-popcorn total: 62+18=8062 + 18 = 80.

Check: 120+80=200120 + 80 = 200. ✓

PopcornNo popcornTotal
Adult48486262110110
Child727218189090
Total1201208080200200

Relative frequencies

Raw counts are hard to compare when groups have different sizes. There are 5454 non-musicians who play a sport and only 2424 musicians, but there are also more non-musicians overall. To compare fairly, divide by a total to get a relative frequency (a fraction, decimal or percent).

Definition

Relative frequencies

  • Joint relative frequency =cellgrand total= \dfrac{\text{cell}}{\text{grand total}}. Example: 24150=16%\dfrac{24}{150} = 16\% of all students play an instrument and a sport.
  • Marginal relative frequency =row or column totalgrand total= \dfrac{\text{row or column total}}{\text{grand total}}. Example: 60150=40%\dfrac{60}{150} = 40\% of all students play an instrument.
  • Conditional relative frequency =cellits row total or column total= \dfrac{\text{cell}}{\text{its row total or column total}}. It describes one group only. Example: of the 6060 students who play an instrument, 2460=40%\dfrac{24}{60} = 40\% play a sport.

The word of tells you which total to divide by. "Percent of the musicians who play a sport" divides by the number of musicians.

Common mistake

Changing which group you condition on changes the answer.

  • Percent of instrument players who play a sport: 2460=40%\dfrac{24}{60} = 40\%.
  • Percent of sport players who play an instrument: 2478≈30.8%\dfrac{24}{78} \approx 30.8\%.

Same cell, different denominators, different questions. Before dividing, ask yourself, "percent of whom?"

Looking for an association

Two categorical variables are associated if knowing one of them changes the likely value of the other. To test this, compare conditional relative frequencies across the groups.

For the survey: 2460=40%\dfrac{24}{60} = 40\% of instrument players play a sport, but 5490=60%\dfrac{54}{90} = 60\% of the other students do. That's a big difference, so in this school the two variables are associated: students who play an instrument are less likely to play a sport.

Testing for association

Compute the same conditional relative frequency for each group (for example, the percent who say "yes" in each row).

  • If the percents are about equal, there is no association.
  • If they are clearly different, there is an association.

An association does not tell you why. Maybe music practice leaves less time for sports, or maybe something else explains both. You'll look at this more carefully in the next lesson.

Relative frequency tables

It's often useful to turn a whole table into percents. Dividing each cell by its row total gives a row relative frequency table, and each row then adds to 100%100\%. Dividing by column totals gives a column relative frequency table.

Worked example: Where do you get your news?

A survey asked 240240 adults whether they get most of their news online or from TV.

OnlineTVTotal
Under 30646416168080
30 to 5060604040100100
Over 50181842426060
Total1421429898240240

Make a row relative frequency table. Is there an association between age group and news source?

Divide each cell by its row total:

OnlineTVTotal
Under 306480=80%\frac{64}{80} = 80\%1680=20%\frac{16}{80} = 20\%100%100\%
30 to 5060100=60%\frac{60}{100} = 60\%40100=40%\frac{40}{100} = 40\%100%100\%
Over 501860=30%\frac{18}{60} = 30\%4260=70%\frac{42}{60} = 70\%100%100\%

The percent who prefer online news falls from 80%80\% to 60%60\% to 30%30\% as age increases. The percents are very different, so there is a strong association between age group and news source: younger adults in this survey were much more likely to get their news online.

Tip

Row percentages answer "within each row group, how do people split?" Choose the direction that matches your question. To compare age groups, divide by the age-group totals.

Practice

This table is used in the next three problems. It shows whether 8080 students ate breakfast this morning.

Ate breakfastSkipped breakfastTotal
Grade 9222218184040
Grade 1027274040
Total494931318080
Practice 1

Look at the breakfast table above. How many grade 10 students skipped breakfast?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

Look at the breakfast table above. What percent of all 8080 students are in grade 10 and ate breakfast?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

Look at the breakfast table above. Of the students who skipped breakfast, what percent are in grade 9? Round to the nearest tenth of a percent.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

The table below is used in the next two problems. It shows how 180180 students get to school.

WalksDoesn't walkTotal
Lives within 1 mile454515156060
Lives farther away1212108108120120
Total5757123123180180
Practice 4

Look at the walking table above. What percent of all the students walk to school? Round to the nearest tenth of a percent.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Look at the walking table above. Which statement best describes the relationship between distance and walking?

Practice 6

In a survey, 3030 of the 5050 students who own a pet said they like hiking, and 3030 of the 4040 students who like hiking own a pet. What percent of the pet owners like hiking?

Practice 7

A club has 200200 members. 45%45\% of the members are juniors and the rest are seniors. 60%60\% of the juniors and 4040 of the seniors want to go on a class trip. Of the members who want to go on the trip, what percent are seniors? Round to the nearest tenth of a percent.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 8

A survey of two groups produced this table.

YesNoTotal
Group A121218183030
Group Bxx4242x+42x + 42

For what value of xx would there be no association between group and answer (the same percent of each group says yes)?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.