Lesson 12.4 · Probability
Two-way tables and probability
Surveys often record two things about each person: grade and favorite sport, age and phone brand, whether someone was vaccinated and whether they got sick. A two-way table organizes that kind of data so you can read off probabilities, including conditional ones, and decide whether the two variables are related.
Reading a two-way table
Definition
Two-way table
A two-way table shows counts for two categorical variables at once. One variable labels the rows and the other labels the columns. Each inner cell counts the people (or items) in one row category and one column category. The Total row and column give the counts for each category alone.
Here is a survey of people about whether they prefer dogs or cats.
| Dogs | Cats | Total | |
|---|---|---|---|
| Adults | |||
| Teens | |||
| Total |
- The inner cells are joint counts: people are teens and prefer dogs.
- The totals on the edge are marginal counts: people prefer dogs, regardless of age.
- Always check that each row and column adds up. Here and .
Three kinds of probability
Suppose one of these people is chosen at random.
Probabilities from a two-way table
- Marginal probability (one variable only): divide a total by the grand total. .
- Joint probability (both variables): divide an inner cell by the grand total. .
- Conditional probability (given one variable): divide an inner cell by the total of the given row or column. .
The conditional one is where the table really helps. "Given teen" means you look only at the Teens row, so its total, , becomes the denominator.
Worked example: Which way does the bar go?
Using the pet table, find and .
Given teen: restrict to the Teens row. Of teens, prefer dogs.
Given dogs: restrict to the Dogs column. Of dog lovers, are teens.
Same cell, different denominators, different answers.
Common mistake
The most common error is using the grand total when the question says "given." If the question gives you a condition, the denominator is the total for that row or column, never the grand total.
"Or" from a table
For , use the addition rule, or add up the cells directly without repeating any.
Worked example: An or question
Using the pet table, find .
With the addition rule:
Check by counting cells: every adult () plus the teens who prefer cats () gives people. Same answer.
Relative frequency tables
Divide every entry by the grand total and you get a relative frequency table. Each entry is now a joint or marginal probability, and the grand total becomes .
| Dogs | Cats | Total | |
|---|---|---|---|
| Adults | |||
| Teens | |||
| Total |
You can compute conditional probabilities from this table too, with the formula . For example, .
Are the variables independent?
Two variables are independent if knowing one tells you nothing about the other. In a table, that means the conditional probability is the same in every row, and equal to the overall (marginal) probability.
Worked example: Testing independence in a table
Pet survey. , but . Since these differ, preferring dogs is not independent of age group in this survey.
Sports survey. Here is a different school survey of students.
| Plays a sport | No sport | Total | |
|---|---|---|---|
| Grade 9 | |||
| Grade 10 | |||
| Total |
and , which also equals . Playing a sport is independent of grade here. You can confirm it with the product test: , and .
Tip
To fill in a table with missing entries, remember that every row and every column must add to its total. Fill in whatever cell has only one unknown in its row or column, then repeat.
Practice
Problems 1–6 use this survey of juniors and seniors about their favorite kind of movie.
| Comedy | Action | Drama | Total | |
|---|---|---|---|---|
| Juniors | ||||
| Seniors | ||||
| Total |
A student is chosen at random. What is ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Is preferring drama independent of being a senior?
A club surveyed members from two groups. Some entries are missing.
| Yes | No | Total | |
|---|---|---|---|
| Group A | |||
| Group B | |||
| Total |
What is ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
In a survey of people, own a bike and are under years old. Suppose owning a bike is independent of being under . How many people would you expect to be under and own a bike?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.