Two-Way Tables and Independence
A rapid strep test at school comes back positive. How sure should you be that you really have strep? The answer surprises most people, and it depends on more than how accurate the test is. By the end of this page you will know how to work it out.
Reading a two-way table
A two-way frequency table sorts the same group of people (or objects) by two categories at once. One category runs down the rows, the other across the columns.
Here is a survey of 150 students about lunch.
| Buys lunch | Brings lunch | Total | |
|---|---|---|---|
| Freshman | 40 | 35 | 75 |
| Sophomore | 30 | 45 | 75 |
| Total | 70 | 80 | 150 |
Every number answers a different question:
-
A number inside the table is a joint frequency: it counts people with both traits, such as sophomores and bringing lunch.
-
A number in the Total row or column is a marginal frequency: it counts one trait only.
-
The bottom-right number is the grand total.
The probability that the event does not happen is the complement:
$$P(A^c) = 1 - P(A)$$This works because the event and its complement together cover every student, so their probabilities add to $1$.
A relative frequency table divides every count by the grand total, so the numbers are probabilities (and the grand total is $1$).
When some cells are missing, use the fact that each row and each column adds up to its total. Fill in the easy blanks first.
A high school surveyed $200$ students about whether they participate in after-school sports. The results are shown in the two-way frequency table below: | | Plays a…
A high school surveyed $200$ students about whether they participate in after-school sports. The results are shown in the two-way frequency table below:
| Plays a Sport | Does Not Play | Total | |
|---|---|---|---|
| 9th Grade | 45 | 55 | 100 |
| 10th Grade | 65 | 35 | 100 |
| Total | 110 | 90 | 200 |
If one student is selected at random from this group, what is the probability that the student is a 10th grader who plays a sport? Express your answer as a decimal.
A survey asked $500$ residents of a town about their primary source of daily news. | | TV | Internet | Print | Total | |---|---|---|---|---| | Under 40 | 40 | 180 | 30 |…
A survey asked $500$ residents of a town about their primary source of daily news.
| TV | Internet | Total | ||
|---|---|---|---|---|
| Under 40 | 40 | 180 | 30 | 250 |
| 40 and Over | 120 | 80 | 50 | 250 |
| Total | 160 | 260 | 80 | 500 |
Let $I$ be the event that a randomly selected resident's primary news source is the Internet. Find the probability of the complement of $I$, denoted as $P(I^c)$.
A city council is considering building a new public park. They surveyed residents to gauge support. Some of the data on the spreadsheet was accidentally deleted, leaving…
A city council is considering building a new public park. They surveyed residents to gauge support. Some of the data on the spreadsheet was accidentally deleted, leaving the incomplete table below:
| Supports Park | Opposes Park | Undecided | Total | |
|---|---|---|---|---|
| Homeowner | 120 | $x$ | 30 | 200 |
| Renter | $y$ | 40 | $z$ | 150 |
| Total | 210 | 90 | 50 | 350 |
First, determine the missing values $x$, $y$, and $z$. Then, if a surveyed resident is selected at random, find the probability that they are a renter, given that they support the park.
Conditional probability
Suppose you are told the student you picked is a sophomore. Now you are not choosing from all 150 students. You are choosing from the sophomore row only, which has 75 students. The word given means "shrink the group to this row or column."
Why does the rule work? Divide the top and bottom of $\dfrac{45}{75}$ by $150$ and you get $\dfrac{45/150}{75/150} = \dfrac{P(A \text{ and } B)}{P(B)}$. It is the same fraction, just written with probabilities.
You can also work from a relative frequency table. Divide the joint probability by the marginal probability of the given event.
| Android | iPhone | Total | |
|---|---|---|---|
| Teen | 0.10 | 0.30 | 0.40 |
| Adult | 0.25 | 0.35 | 0.60 |
| Total | 0.35 | 0.65 | 1.00 |
A company tracked the commuting methods and punctuality of its employees for a month to see if transportation type affects arrival times. | | On Time | Late | Total |…
A company tracked the commuting methods and punctuality of its employees for a month to see if transportation type affects arrival times.
| On Time | Late | Total | |
|---|---|---|---|
| Drives Car | 120 | 30 | 150 |
| Takes Bus | 40 | 10 | 50 |
| Total | 160 | 40 | 200 |
Find the conditional probability that an employee was on time, given that they took the bus.
A clinic uses a rapid test for a particular strain of flu. The two-way table shows the results of $1,000$ patients who were tested and later confirmed by a more accurate…
A clinic uses a rapid test for a particular strain of flu. The two-way table shows the results of $1,000$ patients who were tested and later confirmed by a more accurate lab test.
| Has Flu | No Flu | Total | |
|---|---|---|---|
| Test Positive | 180 | 40 | 220 |
| Test Negative | 20 | 760 | 780 |
| Total | 200 | 800 | 1,000 |
A "false positive" occurs when a patient tests positive but does not actually have the flu. What is the probability of a false positive, given that the patient does not have the flu?
A marketing firm created a two-way relative frequency table showing the relationship between age group and preferred streaming service for a sample of US adults. | |…
A marketing firm created a two-way relative frequency table showing the relationship between age group and preferred streaming service for a sample of US adults.
| Service A | Service B | Service C | Total | |
|---|---|---|---|---|
| 18-35 years | 0.25 | 0.15 | 0.10 | 0.50 |
| Over 35 years | 0.10 | 0.20 | 0.20 | 0.50 |
| Total | 0.35 | 0.35 | 0.30 | 1.00 |
If an adult from the survey is randomly selected and it is known they prefer Service B, what is the probability that they are over 35 years old? Round to the nearest thousandth.
Independent events
Two events are independent when knowing that one happened does not change the probability of the other. Are "being a sophomore" and "bringing lunch" independent? Compare the conditional probability with the overall probability.
In the lunch table, $P(\text{brings lunch}) = \dfrac{80}{150} \approx 0.533$, but $P(\text{brings lunch} \mid \text{sophomore}) = 0.6$. These are different, so the events are dependent: sophomores in this survey are more likely to bring lunch.
Now look at a table where the rates match. A teacher asks 100 students about band and part-time jobs.
| Has a job | No job | Total | |
|---|---|---|---|
| In band | 24 | 56 | 80 |
| Not in band | 6 | 14 | 20 |
| Total | 30 | 70 | 100 |
$P(\text{job} \mid \text{band}) = \dfrac{24}{80} = 0.3$, $P(\text{job} \mid \text{not band}) = \dfrac{6}{20} = 0.3$, and $P(\text{job}) = \dfrac{30}{100} = 0.3$. All three match, so the events are independent. Band membership tells you nothing about who has a job.
There is a second way to test, using "and". The events are independent exactly when
$$P(A \text{ and } B) = P(A) \cdot P(B)$$Check it: $P(\text{band and job}) = \dfrac{24}{100} = 0.24$ and $P(\text{band}) \cdot P(\text{job}) = 0.8 \times 0.3 = 0.24$. ✓
Sometimes a number is missing and you are told the events are independent. Set the two rates equal.
A researcher is studying the relationship between gender and left-handedness in a sample of $300$ adults. | | Left-Handed | Right-Handed | Total | |---|---|---|---| |…
A researcher is studying the relationship between gender and left-handedness in a sample of $300$ adults.
| Left-Handed | Right-Handed | Total | |
|---|---|---|---|
| Male | 15 | 135 | 150 |
| Female | 15 | 135 | 150 |
| Total | 30 | 270 | 300 |
Calculate $P(\text{Left-Handed} \mid \text{Male})$ and $P(\text{Left-Handed})$. Based on comparing these probabilities, are the events "being male" and "being left-handed" independent?
A university analyzed the choice of major among its $1,200$ incoming freshmen by gender to check for demographic trends. | | STEM Major | Humanities Major | Total |…
A university analyzed the choice of major among its $1,200$ incoming freshmen by gender to check for demographic trends.
| STEM Major | Humanities Major | Total | |
|---|---|---|---|
| Male | 360 | 240 | 600 |
| Female | 240 | 360 | 600 |
| Total | 600 | 600 | 1,200 |
Let $S$ be the event that a student chooses a STEM major, and $M$ be the event that the student is male. Calculate $P(S)$, $P(S \mid M)$, and $P(S \mid M^c)$. Are the events $S$ and $M$ independent? Explain your reasoning using the calculated probabilities.
A quality control inspector at a factory is analyzing the defect rate of two different assembly lines. The results of yesterday's production are shown in the table…
A quality control inspector at a factory is analyzing the defect rate of two different assembly lines. The results of yesterday's production are shown in the table below, where $k$ represents an unknown number of defective items from Line B.
| Defective | Not Defective | Total | |
|---|---|---|---|
| Line A | 12 | 288 | 300 |
| Line B | $k$ | $200 - k$ | 200 |
| Total | $12 + k$ | $488 - k$ | 500 |
Find the value of $k$ that would make the event "item is defective" perfectly independent of the event "item was produced on Line B".
Venn diagrams and the addition rule
A Venn diagram shows the same information as a two-way table, using overlapping circles. Take 40 students. Some play soccer ($S$), some run track ($T$), some do both, and some do neither.
The overlap, $S$ and $T$, is the intersection $S \cap T$. Everything inside at least one circle is the union $S \cup T$. In math, "or" is inclusive: it means one, the other, or both.
To find the probability of "$S$ or $T$", you might add the two circles: $\dfrac{20}{40} + \dfrac{15}{40}$. But the 6 students in the overlap would be counted twice, so subtract them once.
To go from a Venn diagram to a conditional probability, restrict to the given circle. The given circle becomes your whole sample space.
Sometimes the regions are written with a variable such as $x$. The regions of a Venn diagram must add up to the total, so write that sum, set it equal to the total, and solve for $x$. Then read the probabilities off the diagram.
The addition rule can also be solved backwards for the overlap.
The Venn diagram below shows the number of seniors at Washington High School who are in the Drama Club (Event $D$) and the Jazz Band (Event $J$). If a senior is selected…
The Venn diagram below shows the number of seniors at Washington High School who are in the Drama Club (Event $D$) and the Jazz Band (Event $J$).
If a senior is selected at random from this group, what is the probability that they are in the Drama Club OR the Jazz Band (or both)?
At a local diner in Chicago, the probability that a customer orders a burger is $0.65$, and the probability that a customer orders fries is $0.70$. The probability that…
At a local diner in Chicago, the probability that a customer orders a burger is $0.65$, and the probability that a customer orders fries is $0.70$. The probability that a customer orders both a burger and fries is $0.55$. Use the addition rule to find the probability that a customer orders a burger or fries (or both).
In a standard deck of $52$ playing cards, let event $A$ be drawing a Heart and event $B$ be drawing a Face card (Jack, Queen, or King). The probability of drawing a…
In a standard deck of $52$ playing cards, let event $A$ be drawing a Heart and event $B$ be drawing a Face card (Jack, Queen, or King). The probability of drawing a Heart is $\frac{13}{52}$, and the probability of drawing a Face card is $\frac{12}{52}$. The probability of drawing a card that is a Heart OR a Face card is $\frac{22}{52}$.
Use the addition rule to find the probability of drawing a card that is BOTH a Heart and a Face card. Based on your result, are events $A$ and $B$ mutually exclusive?
The multiplication rule
Emma makes $70\%$ of her free throws, and each shot is independent of the others. What is the chance she makes two in a row? She must make the first and the second. Picture a unit square: the width is split by the first event, and the height by the second.
The overlap is a rectangle whose area is width times height. That is the multiplication rule.
For independent events, there is a handy form of the addition rule too. "Neither" has probability $P(A^c) \cdot P(B^c)$, and $P(A \cup B) = 1 - P(\text{neither})$.
When two probabilities are related by a sentence such as "$P(A)$ is twice $P(B)$", write both using one variable. For example, if $P(A) = 2p$ and $P(B) = p$, then independence gives $P(A \cap B) = 2p \cdot p = 2p^2$. Set that equal to the given number and solve for $p$. Since probabilities are never negative, keep only the positive solution.
A fair six-sided die is rolled, and a fair US quarter is flipped. Let $A$ be the event of rolling a number greater than $4$, and let $B$ be the event of the coin landing…
A fair six-sided die is rolled, and a fair US quarter is flipped. Let $A$ be the event of rolling a number greater than $4$, and let $B$ be the event of the coin landing on heads. Assuming these events are completely independent, what is the exact probability of both $A$ and $B$ occurring?
Let $A$ and $B$ be two events in a sample space. You are given that $P(A) = 0.55$, $P(B) = 0.40$, and $P(A \cap B) = 0.22$. First, calculate $P(A \cup B)$. Then,…
Let $A$ and $B$ be two events in a sample space. You are given that $P(A) = 0.55$, $P(B) = 0.40$, and $P(A \cap B) = 0.22$.
First, calculate $P(A \cup B)$. Then, determine if events $A$ and $B$ are independent, showing the specific mathematical condition you used to test for independence.
A bag contains $5$ red marbles, $4$ blue marbles, and $3$ green marbles. Two marbles are drawn at random without replacement. Let $R_1$ be the event that the first…
A bag contains $5$ red marbles, $4$ blue marbles, and $3$ green marbles. Two marbles are drawn at random without replacement. Let $R_1$ be the event that the first marble is red, and $R_2$ be the event that the second marble is red.
Calculate $P(R_1)$, $P(R_2 \mid R_1)$, and $P(R_1 \cap R_2)$. Then, calculate the total probability that the second marble is red, $P(R_2)$, by considering both cases for the first marble. Are $R_1$ and $R_2$ independent events?
Tree diagrams and the strep test
A tree diagram lays out events in stages. Each branch is labeled with a probability. The second-stage probabilities are conditional on the first stage.
Back to the opening problem. Suppose $10\%$ of the students tested have strep. The test is positive for $90\%$ of students who have strep, and also (by mistake) for $10\%$ of students who do not.
This second idea is the total probability rule:
$$P(B) = P(A) \cdot P(B \mid A) + P(A^c) \cdot P(B \mid A^c)$$It adds up every path that ends in $B$.
Back to the opening question: a positive result, even from a test that is right $90\%$ of the time for sick students, means only a $50\%$ chance of strep here. Strep is uncommon ($10\%$), so the false positives from the large healthy group are as many as the true positives from the small sick group. When a problem gives percentages, a good first step is to pick a convenient total (like $1{,}000$ or $10{,}000$), turn the percentages into counts, and fill in a two-way table.
The tree diagram below shows the probabilities of weather conditions in Seattle on a given autumn day, and whether an office worker, Alex, remembers to bring an…
The tree diagram below shows the probabilities of weather conditions in Seattle on a given autumn day, and whether an office worker, Alex, remembers to bring an umbrella.
Use the multiplication rule to find the probability that it rains AND Alex brings an umbrella. Then, find the total probability that Alex brings an umbrella, regardless of the weather.
At a car dealership, $60\%$ of the vehicles are SUVs, and $40\%$ are sedans. Of the SUVs, $30\%$ have four-wheel drive (4WD). Of the sedans, $10\%$ have 4WD. Construct a…
At a car dealership, $60\%$ of the vehicles are SUVs, and $40\%$ are sedans. Of the SUVs, $30\%$ have four-wheel drive (4WD). Of the sedans, $10\%$ have 4WD. Construct a two-way probability table (or a tree diagram) to represent this situation. What is the probability that a randomly selected vehicle from this dealership has 4WD?
A rare disease affects $1$ in every $1,000$ people in a certain US state. A diagnostic test has been developed that is $98\%$ accurate for people who have the disease…
A rare disease affects $1$ in every $1,000$ people in a certain US state. A diagnostic test has been developed that is $98\%$ accurate for people who have the disease (sensitivity) and $95\%$ accurate for people who do not have the disease (specificity). The tree diagram below illustrates the probabilities.
If a person is chosen at random from the population, administered the test, and receives a positive result, what is the probability that they actually have the disease? Round your answer to the nearest tenth of a percent.