Algebra 1Data Analysis3 of 5
Data Analysis · 3

Two-Way Tables

When we ask the same group of people two yes-or-no or category questions at once, two separate lists of totals can't show how the groups overlap. For our example, we survey all 200200 students at one school.

1

Joint and Marginal Frequencies

A two-way table sorts every person by both answers at the same time: one question sets the rows, the other sets the columns, and each person goes into the box where their row and column meet.

Joint and Marginal Frequencies
200 students200\ \text{students}
Sport\htmlClass{lc-blue}{\text{Sport}}
150\htmlClass{lc-blue}{150}
Yes\text{Yes}
50\htmlClass{lc-violet}{50}
No\text{No}
Instrument\text{Instrument}
5050
Yes\text{Yes}
150150
No\text{No}
How many athletes play an instrument?\text{How many }\htmlClass{lc-blue}{\text{athletes}}\text{ play an instrument?}
Instrument\text{Instrument}
No\text{No}
Instrument\text{Instrument}
Total\text{Total}
Sport\htmlClass{lc-blue}{\text{Sport}}
30\htmlClass{lc-blue}{30}
120\htmlClass{lc-blue}{120}
150\htmlClass{lc-blue}{150}
No\htmlClass{lc-violet}{\text{No}}
Sport\htmlClass{lc-violet}{\text{Sport}}
20\htmlClass{lc-violet}{20}
30\htmlClass{lc-violet}{30}
50\htmlClass{lc-violet}{50}
Total\text{Total}
5050
150150
200200
Joint frequencies (overlap)\text{Joint frequencies (overlap)}
Marginal frequencies\text{Marginal frequencies}
(margins)\text{(margins)}
Grand\text{Grand}
total\text{total}

As the 5050 musicians shift between the athlete and non-athlete groups, all four inside counts adjust together while the four marginal totals on the outside edges stay fixed at 150\first{150}, 50\second{50}, 5050, and 150150.

Even when the outside totals stay the same, changing how many musicians are athletes changes all four inside counts together so every row and column still adds up.
2

Completing a Two-Way Table

Often we are given a two-way table with several counts missing and need to fill them in. Because every row and column adds up to the total on its edge, any row or column with two known numbers automatically gives you the third.

Completing a Two-Way Table
Instrument\text{Instrument}
No\text{No}
Instrument\text{Instrument}
Total\text{Total}
Sport\htmlClass{lc-blue}{\text{Sport}}
30\htmlClass{lc-blue}{30}
?\htmlClass{lc-mute}{?}
150\htmlClass{lc-blue}{150}
No\htmlClass{lc-violet}{\text{No}}
Sport\htmlClass{lc-violet}{\text{Sport}}
?\htmlClass{lc-mute}{?}
30\htmlClass{lc-violet}{30}
?\htmlClass{lc-mute}{?}
Total\text{Total}
5050
?\htmlClass{lc-mute}{?}
200200
Text solution
Subtract from the edge total to find missing inside counts In both the Sport row and the Instrument column, we know one inside box and the marginal total, so we subtract to find the other inside box.
Sport, No Instrument=150−30=120No Sport, Instrument=50−30=20\displaystyle \begin{aligned} &\text{Sport, No Instrument} \\ &\quad = \first{150} - \first{30} = \first{120} \\ &\text{No Sport, Instrument} \\ &\quad = 50 - \first{30} = \second{20} \end{aligned}
Add the inside counts to fill the remaining marginal totals With all four inside boxes filled, we add down the second column and across the No Sport row, then check that both edges add to the corner grand total of 200200.
No Instrument total=120+30=150No Sport total=20+30=50Grand total check=150+50=50+150=200\displaystyle \begin{aligned} &\text{No Instrument total} \\ &\quad = \first{120} + \second{30} = 150 \\ &\text{No Sport total} \\ &\quad = \second{20} + \second{30} = \second{50} \\ &\text{Grand total check} \\ &\quad = \first{150} + \second{50} = 50 + 150 = 200 \end{aligned}
3

Joint and Marginal Relative Frequencies

When two groups are different sizes, like 150\first{150} athletes and 50\second{50} non-athletes, comparing raw counts isn't a fair comparison. Instead, we find a relative frequency, which expresses a count as a proportion or percentage of a total:

Relative Frequency\displaystyle \text{Relative Frequency} =PartTotal\displaystyle = \frac{\text{Part}}{\whole{\text{Total}}}

To see how the entire survey of 200200 students breaks down by percentage, we use the grand total of 200\whole{200} in the denominator.

Joint and Marginal Relative Frequencies
Instrument\text{Instrument}
No\text{No}
Instrument\text{Instrument}
Total\text{Total}
Sport\htmlClass{lc-blue}{\text{Sport}}
30\htmlClass{lc-blue}{30}
120\htmlClass{lc-blue}{120}
150\htmlClass{lc-blue}{150}
No\htmlClass{lc-violet}{\text{No}}
Sport\htmlClass{lc-violet}{\text{Sport}}
20\htmlClass{lc-violet}{20}
30\htmlClass{lc-violet}{30}
50\htmlClass{lc-violet}{50}
Total\text{Total}
5050
150150
200200
30200=  ?\dfrac{\htmlClass{lc-blue}{30}}{\htmlClass{lc-green}{200}}=\;?
Text solution
Divide each inside count by the grand total for joint relative frequencies Dividing each overlap count by the corner total of 200\whole{200} gives the percentage of the whole school in each inside box.
Sport and Instrument=30200=0.15=15%Sport and No Instrument=120200=0.60=60%No Sport and Instrument=20200=0.10=10%No Sport and No Instrument=30200=0.15=15%\displaystyle \begin{aligned} &\text{Sport and Instrument} \\ &\quad = \frac{\first{30}}{\whole{200}} = 0.15 = \first{15\%} \\ &\text{Sport and No Instrument} \\ &\quad = \frac{\first{120}}{\whole{200}} = 0.60 = \first{60\%} \\ &\text{No Sport and Instrument} \\ &\quad = \frac{\second{20}}{\whole{200}} = 0.10 = \second{10\%} \\ &\text{No Sport and No Instrument} \\ &\quad = \frac{\second{30}}{\whole{200}} = 0.15 = \second{15\%} \end{aligned}
Divide each edge total by the grand total for marginal relative frequencies Dividing the row and column totals by 200\whole{200} gives the single-category percentages for the whole school, which add up to 1.001.00 (100%100\%) in the bottom-right corner.
Sport total=150200=0.75=75%No Sport total=50200=0.25=25%Instrument total=50200=0.25=25%No Instrument total=150200=0.75=75%\displaystyle \begin{aligned} &\text{Sport total} \\ &\quad = \frac{\first{150}}{\whole{200}} = 0.75 = \first{75\%} \\ &\text{No Sport total} \\ &\quad = \frac{\second{50}}{\whole{200}} = 0.25 = \second{25\%} \\ &\text{Instrument total} \\ &\quad = \frac{50}{\whole{200}} = 0.25 = 25\% \\ &\text{No Instrument total} \\ &\quad = \frac{150}{\whole{200}} = 0.75 = 75\% \end{aligned}
4

Conditional Relative Frequencies

Comparing the joint percentages still doesn't account for the different sizes of the athlete and non-athlete groups. To find a percentage inside one specific group, we calculate a conditional relative frequency by looking at just that row or column and dividing by its marginal total.

Conditional Relative Frequencies
Instrument\text{Instrument}
No\text{No}
Instrument\text{Instrument}
Total\text{Total}
Sport\htmlClass{lc-blue}{\text{Sport}}
30\htmlClass{lc-blue}{30}
120\htmlClass{lc-blue}{120}
150\htmlClass{lc-blue}{150}
No\htmlClass{lc-violet}{\text{No}}
Sport\htmlClass{lc-violet}{\text{Sport}}
20\htmlClass{lc-violet}{20}
30\htmlClass{lc-violet}{30}
50\htmlClass{lc-violet}{50}
Total\text{Total}
5050
150150
200200
Among athletes:30?=  ?\text{Among }\htmlClass{lc-blue}{\text{athletes}}\text{:}\quad\dfrac{\htmlClass{lc-blue}{30}}{\htmlClass{lc-green}{?}}=\;?
Text solution
Divide each row by its own row total to compare the two groups fairly Finding the percentage of musicians within each row separately shows how likely each group is to play an instrument.
Athletes who playan instrument=30150=0.20=20%Non-athletes who playan instrument=2050=0.40=40%\displaystyle \begin{aligned} &\text{Athletes who play} \\ &\text{an instrument} \\ &\quad = \frac{\first{30}}{\whole{150}} = 0.20 = \first{20\%} \\ &\text{Non-athletes who play} \\ &\text{an instrument} \\ &\quad = \frac{\second{20}}{\whole{50}} = 0.40 = \second{40\%} \end{aligned}
So non-athletes (40%\second{40\%}) are actually twice as likely to play an instrument as athletes (20%\first{20\%}), even though athletes had the larger raw count (30\first{30} vs. 20\second{20}).
Use the group named right after "of" or "if" as the denominator "What percent of athletes play an instrument?" and "What percent of musicians play a sport?" both put the same 30\first{30} students on top, but they use different totals on the bottom.
Percent of athleteswho play an instrument=30150⏟Sport row total=0.20=20%Percent of musicianswho play a sport=3050⏟Instrument column total=0.60=60%\displaystyle \begin{aligned} &\text{Percent }\mathbf{of\ athletes} \\ &\text{who play an instrument} \\ &\quad = \frac{\first{30}}{\underbrace{\whole{150}}_{\text{Sport row total}}} \\ &\quad = 0.20 = \first{20\%} \\ &\text{Percent }\mathbf{of\ musicians} \\ &\text{who play a sport} \\ &\quad = \frac{\first{30}}{\underbrace{\whole{50}}_{\text{Instrument column total}}} \\ &\quad = 0.60 = \first{60\%} \end{aligned}

In this table, the exact same 30\first{30} students in the Sport and Instrument box are 15%\first{15\%} of the whole school, 20%\first{20\%} of the athletes, and 60%\first{60\%} of the musicians, depending on which group's total we divide by.

Looking at the whole school, one row, or one column changes which total counts as 100%, turning the same box of students into a different percentage each time.
5

Conditional Relative Frequencies from Percentages or Decimals

Sometimes a problem doesn't give raw counts at all. Instead, it only gives the whole-survey percentages (adding to 100%100\%) or decimals (adding to 1.001.00), and we still need to find a conditional relative frequency.

Conditional Relative Frequencies from Percentages or Decimals
Instrument\text{Instrument}
No\text{No}
Instrument\text{Instrument}
Total\text{Total}
Sport\htmlClass{lc-blue}{\text{Sport}}
15%\htmlClass{lc-blue}{15\%}
60%\htmlClass{lc-blue}{60\%}
75%\htmlClass{lc-blue}{75\%}
No\htmlClass{lc-violet}{\text{No}}
Sport\htmlClass{lc-violet}{\text{Sport}}
10%\htmlClass{lc-violet}{10\%}
15%\htmlClass{lc-violet}{15\%}
25%\htmlClass{lc-violet}{25\%}
Total\text{Total}
25%25\%
75%75\%
100%100\%
Instrument, given Sport=  ?\text{Instrument, given }\htmlClass{lc-blue}{\text{Sport}}=\;?
Text solution
Divide the inside percentage by the row or column marginal percentage Because percentages mean parts per 100100, dividing the overlap percentage by the group's marginal percentage gives the exact same result as dividing the raw counts.
Athletes who play an instrument=15%75%=1575=0.20=20%\displaystyle \begin{aligned} &\text{Athletes who play an instrument} \\ &\quad = \frac{\first{15\%}}{\whole{75\%}} = \frac{\first{15}}{\whole{75}} = 0.20 = \first{20\%} \end{aligned}
Use the same division when the table is given in decimals Take the overlap decimal (0.15\first{0.15}) and divide by the Sport row total (0.75\whole{0.75}) when the condition is playing a sport, or by the Instrument column total (0.25\whole{0.25}) when the condition is playing an instrument.
Given Sport, plays an instrument=0.150.75=0.20=20%Given Instrument, plays a sport=0.150.25=0.60=60%\displaystyle \begin{aligned} &\text{Given Sport, plays an instrument} \\ &\quad = \frac{\first{0.15}}{\whole{0.75}} = 0.20 = \first{20\%} \\ &\text{Given Instrument, plays a sport} \\ &\quad = \frac{\first{0.15}}{\whole{0.25}} = 0.60 = \first{60\%} \end{aligned}

If dividing decimals or percentages ever feels strange, just pretend the survey had 100100 people. Then 0.15\first{0.15} (15%\first{15\%}) is 15\first{15} people out of 75\whole{75} people (0.75\whole{0.75}, or 75%\whole{75\%}).

6

Association in Two-Way Tables

An association between two categories means that knowing a person's answer to the first question changes how likely they are to give a certain answer to the second question. We test for an association by comparing the conditional relative frequencies across the groups.

Association in Two-Way Tables
Instrument\text{Instrument}
No\text{No}
Instrument\text{Instrument}
Total\text{Total}
Sport\htmlClass{lc-blue}{\text{Sport}}
0.15\htmlClass{lc-blue}{0.15}
0.60\htmlClass{lc-blue}{0.60}
0.75\htmlClass{lc-blue}{0.75}
No\htmlClass{lc-violet}{\text{No}}
Sport\htmlClass{lc-violet}{\text{Sport}}
0.10\htmlClass{lc-violet}{0.10}
0.15\htmlClass{lc-violet}{0.15}
0.25\htmlClass{lc-violet}{0.25}
Total\text{Total}
0.250.25
0.750.75
1.001.00
Is there an association?\text{Is there an association?}
Text solution
Compare the conditional percentages between the two groups We look at the percentage of musicians among athletes alongside the percentage of musicians among non-athletes.
Athletes who playan instrument=30150=20%Non-athletes who playan instrument=2050=40%\displaystyle \begin{aligned} &\text{Athletes who play} \\ &\text{an instrument} \\ &\quad = \frac{\first{30}}{\whole{150}} = \first{20\%} \\ &\text{Non-athletes who play} \\ &\text{an instrument} \\ &\quad = \frac{\second{20}}{\whole{50}} = \second{40\%} \end{aligned}
Because 20%\first{20\%} and 40%\second{40\%} are noticeably different, there is an association between playing a sport and playing an instrument.

Equal conditional percentages (20%\first{20\%} of athletes vs. 20%\second{20\%} of non-athletes) mean no association, while equal raw counts (20\first{20} vs. 20\second{20}) in differently sized groups give very different percentages (about 13%\first{13\%} vs. 40%\second{40\%}) and show a clear association.

Two variables are associated when the percentages differ between the two groups, not when the counts are different.

Key concepts

Working with a two-way table comes down to deciding whether you need a raw count or a percentage, and then asking "Out of who?" before you divide:

Raw counts (frequencies)

When a question asks "how many," read the count directly without dividing. An inside box where two categories meet is a joint frequency (30\first{30} play both a sport and an instrument), and an outside edge total is a marginal frequency (150\first{150} play a sport). Use Box+Box=Edge\text{Box} + \text{Box} = \text{Edge} to fill in any missing counts.

Relative frequencies (Part÷Total\text{Part} \div \whole{\text{Total}})

When a question asks for a proportion, decimal, or percent, pick the denominator from the group being described:

  • Out of everyone surveyed: Divide by the grand total in the bottom-right corner (200\whole{200}). Inside boxes give joint relative frequencies (30200=15%\frac{\first{30}}{\whole{200}} = \first{15\%}), and edge totals give marginal relative frequencies (150200=75%\frac{\first{150}}{\whole{200}} = \first{75\%}).
  • Out of one specific group (conditional): Look right after "of", "among", or "given that" and divide by that single row or column's marginal total, whether the table shows counts or whole-group decimals. Among athletes, 30150=0.150.75=20%\frac{\first{30}}{\whole{150}} = \frac{\first{0.15}}{\whole{0.75}} = \first{20\%} play an instrument; among musicians, 3050=0.150.25=60%\frac{\first{30}}{\whole{50}} = \frac{\first{0.15}}{\whole{0.25}} = \first{60\%} play a sport.
Checking for association

Don't compare raw counts (30\first{30} vs. 20\second{20}) when groups are different sizes. Compare the conditional percentages from one group to the next. Noticeably different percentages (20%\first{20\%} of athletes vs. 40%\second{40\%} of non-athletes) mean there is an association, while equal percentages (25%\first{25\%} vs. 25%\second{25\%}) mean no association. Nearly equal percentages show only a small difference between the groups.

7

Practice

1

A school surveyed 250250 students about how they get to school and whether they bring or buy lunch. Fill in the missing numbers in the two-way table below, then state (a) the joint frequency of students who walk and buy lunch, and (b) the marginal frequency of students who walk.

Bring LunchBuy LunchTotal
Walk30\first{30}????
Ride??110\second{110}170\second{170}
Total9090??250250

Look for a row or column that is only missing one number first. Which rows or columns already have two of their three numbers filled in?

Start with the Ride row and the Total column, since each is only missing one number:
Ride, Bring Lunch=170−110=60Walk total=250−170=80\displaystyle \begin{aligned} \text{Ride, Bring Lunch} &= \second{170} - \second{110} = \second{60} \\ \text{Walk total} &= 250 - \second{170} = \first{80} \end{aligned}
Now we can find the remaining boxes in the Walk row and Buy Lunch column:
Walk, Buy Lunch=80−30=50Buy Lunch total=50+110=160\displaystyle \begin{aligned} \text{Walk, Buy Lunch} &= \first{80} - \first{30} = \first{50} \\ \text{Buy Lunch total} &= \first{50} + \second{110} = 160 \end{aligned}
Completed rows: Walk: 30,50,80\first{30}, \first{50}, \first{80}; Ride: 60,110,170\second{60}, \second{110}, \second{170}; Total: 90,160,25090, 160, 250. Watch out for swapping the terms "joint" and "marginal" (which reverses the two answers to 8080 and 5050): a joint frequency is an inside overlap, and a marginal frequency is an edge total. (a) 5050 (b) 8080
2

A movie theater surveyed 400400 customers about their showtime and whether they bought popcorn.

PopcornNo PopcornTotal
Matinee56\first{56}84\first{84}140\first{140}
Evening164\second{164}96\second{96}260\second{260}
Total220220180180400400

Find (a) the joint relative frequency of customers who went to an evening show and bought popcorn, and (b) the marginal relative frequency of customers who went to a matinee.

Neither question is limited to a single row or column. Which total goes on the bottom when a question is about all customers surveyed?

Both questions ask for a share of the whole survey, so divide by the corner grand total of 400\whole{400}. In part (a), don't divide 164164 by the Evening row total of 260260 (which gives approximately 0.6310.631, or 63.1%63.1\%) or the Popcorn column total of 220220 (which gives approximately 0.7450.745, or 74.5%74.5\%); those divide by a single group's total instead of everyone surveyed. (a) 164400=0.41\dfrac{\second{164}}{\whole{400}} = 0.41, or 41%41\% (b) 140400=0.35\dfrac{\first{140}}{\whole{400}} = 0.35, or 35%35\%
3

An animal shelter tracks its 150150 pets by species and whether they are microchipped.

MicrochippedNot MicrochippedTotal
Dogs72\first{72}18\first{18}90\first{90}
Cats48\second{48}12\second{12}60\second{60}
Total1201203030150150

(a) What percent of the dogs are microchipped? (b) What percent of the microchipped pets are dogs?

Both questions put the same 72\first{72} microchipped dogs in the numerator. Look at the group named right after "of" in each question to choose the denominator.

Both parts start with the 72\first{72} pets in the Dogs and Microchipped box, but the denominator changes with the group after "of". Be careful not to divide by the grand total of 150150 (which gives 72150=48%\frac{72}{150} = 48\%, the percent of all shelter pets that are microchipped dogs) or to swap the row total (9090) and column total (120120) between the two parts. (a) Out of the 90\whole{90} dogs: 7290=0.80\dfrac{\first{72}}{\whole{90}} = 0.80, or 80%80\% (b) Out of the 120\whole{120} microchipped pets: 72120=0.60\dfrac{\first{72}}{\whole{120}} = 0.60, or 60%60\%
4

A survey asked commuters where they live and how they get to work. The table shows the relative frequencies for the whole survey as decimals:

TrainDriveTotal
City0.28\first{0.28}0.07\first{0.07}0.35\first{0.35}
Suburbs0.12\second{0.12}0.53\second{0.53}0.65\second{0.65}
Total0.400.400.600.601.001.00

What is the conditional relative frequency that a commuter lives in the city, given that they take the train?

The phrase "given that they take the train" narrows the table to one group. Which marginal decimal is that group's total?

The overlap of City and Train is 0.28\first{0.28}, and the condition "given that they take the train" puts the Train column total of 0.40\whole{0.40} on the bottom. Watch out for two common mistakes: writing down the joint decimal 0.280.28 (28%28\%) without dividing, or dividing by the City row total of 0.350.35 (which gives 0.280.35=0.80\frac{0.28}{0.35} = 0.80, or 80%80\%, the relative frequency of taking the train given that a commuter lives in the city).
0.280.40\displaystyle \frac{\first{0.28}}{\whole{0.40}} =0.70, or 70%\displaystyle = 0.70, \text{ or } 70\%
5

A high school surveyed 200\first{200} underclassmen and 50\second{50} upperclassmen about whether they have a part-time job.

JobNo JobTotal
Underclassmen50\first{50}150\first{150}200\first{200}
Upperclassmen30\second{30}20\second{20}50\second{50}
Total8080170170250250

A student looks at the Job column and says, "50\first{50} is greater than 30\second{30}, so underclassmen are more likely to have a part-time job than upperclassmen." Use conditional relative frequencies to explain why this conclusion is wrong.

Notice how many underclassmen were surveyed compared to upperclassmen. Which total should you divide each group's job count by to make the comparison fair?

Comparing raw counts (50\first{50} vs. 30\second{30}) is unfair because 44 times as many underclassmen were surveyed (200\first{200} vs. 50\second{50}). To compare the two groups fairly, divide each group's job count by its own row total. Don't divide by the Job column total of 8080 (which gives 5080=62.5%\frac{50}{80} = 62.5\% and 3080=37.5%\frac{30}{80} = 37.5\%, making the same mistake because underclassmen make up most of the survey).
Underclassmen with a job=50200=25%,Upperclassmen with a job=3050=60%\displaystyle \begin{aligned} \text{Underclassmen with a job} &= \frac{\first{50}}{\whole{200}} = \first{25\%}, \\ \text{Upperclassmen with a job} &= \frac{\second{30}}{\whole{50}} = \second{60\%} \end{aligned}
Among underclassmen, only 25%\first{25\%} have a job, whereas among upperclassmen, 60%\second{60\%} have a job, so upperclassmen are actually more than twice as likely to have a part-time job.
6

A grocery store tracked 240240 shoppers to see whether they shopped on a weekday or the weekend and whether they used a coupon.

CouponNo CouponTotal
Weekday45\first{45}135\first{135}180\first{180}
Weekend15\second{15}45\second{45}60\second{60}
Total6060180180240240

Does the table show an association between when a person shops and whether they use a coupon? Use conditional relative frequencies to justify your answer.

Compare the percentage of weekday shoppers who used a coupon to the percentage of weekend shoppers who used a coupon. Does the day of the week change how likely a shopper is to use a coupon?

Don't compare the raw counts of 45\first{45} and 15\second{15} (or divide by the Coupon column total of 6060 to get 75%75\% vs. 25%25\%) and conclude that weekday shoppers are three times as likely to use a coupon; three times as many weekday shoppers were surveyed (180\first{180} vs. 60\second{60}). Instead, find the conditional percentage of coupon users within each group's row:
Weekday coupon users=45180=25%,Weekend coupon users=1560=25%\displaystyle \begin{aligned} \text{Weekday coupon users} &= \frac{\first{45}}{\whole{180}} = \first{25\%}, \\ \text{Weekend coupon users} &= \frac{\second{15}}{\whole{60}} = \second{25\%} \end{aligned}
No, because the conditional percentages are identical (25%\first{25\%} vs. 25%\second{25\%}), there is no association.