Joint and marginal probability
One passenger is picked at random from the 400 on a ferry. How likely is it that they hold a first-class return ticket, and how likely that they hold a return ticket of either class?
Where you are 10 in Compound events
Why this exists
A two-way table counts a group of people, or things, by two variables at once. You already know how to read its counts and its totals. Now put the group in a hat and draw one member at random, every member equally likely. “How likely is the member drawn to be such and such?” is a probability question, and the table answers it with one division.
The questions come in two kinds. Some are about both variables at once: is the passenger in first class and holding a return ticket? Others are about one variable only: does the passenger hold a return ticket, whatever the class? The first kind is answered by a single cell of the table, the second by a row or column total. These two kinds of probability have names, and the relationship between them (the total is the sum of its cells) is what every later table calculation leans on.
Definition
Take a two-way table with grand total N, and pick one member of the group at random, each of the N equally likely. Let A be a category of the row variable and B a category of the column variable.
A joint probability is the probability that the member drawn falls in category A and in category B. It is the cell where row A meets column B, divided by the grand total:
A marginal probability is the probability of one variable’s category on its own, with no attention paid to the other variable. It is a row total or a column total, divided by the grand total:
The name comes from where the totals sit: in the margins of the table, along the right edge and the bottom.
The joint probability is also written P(A \cap B), because “in A and in B” is the intersection of the two events, and is often shortened to P(A, B), the comma standing for “and”. All three mean the same number.
Dividing every entry of the table by N, cells and totals alike, gives the joint probability table. Its inside entries are the joint probabilities, its margins are the marginal probabilities, and its bottom-right corner is \displaystyle \frac{N}{N} = 1.
Intuition
Here is the table this lesson keeps coming back to. A survey records the ticket of each of the 400 passengers on one ferry crossing: the class (standard or first) and the type (a single, a return, or a season ticket).
| Standard | First | Total | |
|---|---|---|---|
| Single | 88 | 12 | 100 |
| Return | 136 | 44 | 180 |
| Season | 96 | 24 | 120 |
| Total | 320 | 80 | 400 |
Divide every entry by 400 and you get its joint probability table.
| Standard | First | Total | |
|---|---|---|---|
| Single | 0.22 | 0.03 | 0.25 |
| Return | 0.34 | 0.11 | 0.45 |
| Season | 0.24 | 0.06 | 0.30 |
| Total | 0.80 | 0.20 | 1 |
Think of the whole group as a square of area 1. Cut it into three strips, one per ticket type, each as wide as that type’s share of the passengers. Then cut each strip across, first class on top. Every tile’s area is now a joint probability, and the area of a whole strip, its two tiles together, is the marginal probability of that ticket type.
The picture makes the main fact plain. A marginal probability is never a new piece of information: it is the joint probabilities in its row or column, added up. The three shaded tiles, 0.03 + 0.11 + 0.06, make the first-class share 0.20; the return strip, 0.11 + 0.34, makes 0.45.
Results
Reading a table. For a member drawn at random from a two-way table with grand total N,
and
where n(\ ) is the count in the cell or in the total.
A marginal is the sum of its joints. If B_1, B_2, \ldots, B_k are all the categories of the column variable, then
and in the same way a column’s marginal is the sum of the joint probabilities down that column.
Everything adds to one. The joint probabilities of all the cells add to 1, the marginal probabilities of each variable add to 1, and the corner of the joint probability table is 1.
Why it is true
The two formulas in the first result are the definition of probability for equally likely outcomes: there are N members, each equally likely to be drawn, and the event “the member falls in this cell” (or “in this row”) holds for exactly the members counted there.
For the second result, look at the members in row A. Each of them has exactly one category of the column variable, so each is counted in exactly one cell of the row: no member is missed and none is counted twice. Hence
Divide both sides by N and every count becomes its probability, which is the result. The same fact can be seen as an instance of the addition rule for mutually exclusive events: the events “A and B_1”, “A and B_2” and so on cannot happen together, and together they make up A, so their probabilities add to P(A).
For the third, every member of the group is in exactly one cell, so the cells add to N; so do the row totals, and so do the column totals. Divided by N, each sum becomes 1.
Worked examples
Reading a joint and two marginals
From the ferry table above, one passenger is picked at random. Find the probability that the passenger holds a first-class return ticket, the probability that the passenger holds a return ticket, and the probability that the passenger travels first class.
Solution“First class and a return” names a category of both variables, so it is a joint probability: the cell where the return row meets the first-class column, over the grand total.
“A return ticket”, with nothing said about class, involves the ticket type only. That is a marginal probability, read from the return row’s total.
“First class”, with nothing said about the ticket type, is a marginal probability from the first-class column’s total.
Check: the joint probability is smaller than both marginals, as it must be, because every first-class return passenger is counted in both totals as well.
Building the joint probability table, and checking it
Build the joint probability table for the ferry and check that each marginal is the sum of its joint probabilities.
SolutionDivide each of the twelve entries by the grand total 400. For instance \displaystyle \frac{88}{400} = 0.22 and \displaystyle \frac{136}{400} = 0.34; the full result is the second table in the Intuition section.
Now check the margins against the cells. Down the standard-class column,
and across the season row,
The column marginals add to 0.80 + 0.20 = 1 and the row marginals to 0.25 + 0.45 + 0.30 = 1. Every check passes, so no entry was miscopied. These sums are worth doing every time: an error in one cell shows up at once as a margin that does not match.
Completing a table from probabilities alone
A household in a town is chosen at random. The probability that it has a garden and a car is 0.42, the probability that it has a garden is 0.60, and the probability that it has a car is 0.70. Complete the joint probability table and find the probability that the household has neither a garden nor a car.
SolutionSet out the table with what is known. The joint probability goes in a cell, the two marginals in the margins, and the corner is 1.
| Car | No car | Total | |
|---|---|---|---|
| Garden | 0.42 | 0.60 | |
| No garden | |||
| Total | 0.70 | 1 |
Each margin of one variable adds to 1, so P(\text{no garden}) = 1 - 0.60 = 0.40 and P(\text{no car}) = 1 - 0.70 = 0.30.
The garden row’s marginal is the sum of its two joints, so the missing cell in that row is 0.60 - 0.42 = 0.18. In the same way, down the car column, 0.70 - 0.42 = 0.28.
The last cell can come from the no-garden row: 0.40 - 0.28 = 0.12.
| Car | No car | Total | |
|---|---|---|---|
| Garden | 0.42 | 0.18 | 0.60 |
| No garden | 0.28 | 0.12 | 0.40 |
| Total | 0.70 | 0.30 | 1 |
So P(\text{no garden and no car}) = 0.12. Check it the other way, down the no-car column: 0.18 + 0.12 = 0.30, which matches.
Adding cells for a wider description
From the ferry table, find the probability that a passenger chosen at random travels standard class without a season ticket, and the probability that a passenger travels first class on any ticket except a single.
Solution“Standard class and not a season ticket” means standard class with a single or a return. That description covers two cells of the standard-class column. A passenger is in at most one of them, so their counts, and therefore their probabilities, add.
In the same way, “first class and not a single” covers the return and season cells of the first-class column.
Both answers can be read straight from the joint probability table, 0.22 + 0.34 = 0.56 and 0.11 + 0.06 = 0.17, which is a check.
From a joint probability table back to counts
An animal shelter records every adoption in a year by animal and by age. Its joint probability table is below. The records show that 45 adoptions were young cats. How many adoptions were there in all, how many were older dogs, and how many of the animals adopted were young?
| Young | Older | Total | |
|---|---|---|---|
| Dog | 0.18 | 0.32 | 0.50 |
| Cat | 0.30 | 0.20 | 0.50 |
| Total | 0.48 | 0.52 | 1 |
Every entry of the table is a count divided by the grand total N. The young-cat cell says
so
Now any entry times N is a count. Older dogs: 0.32 \times 150 = 48. Young animals, a marginal: 0.48 \times 150 = 72.
Check: the young column is young dogs plus young cats, 0.18 \times 150 + 45 = 27 + 45 = 72, which agrees.
What the margins alone cannot tell you
In a sports club, a member chosen at random swims with probability 0.6 and runs with probability 0.5. Nothing else is known. What values could the probability that a member does both possibly take?
SolutionCall the unknown joint probability x = P(\text{swims and runs}) and fill in the rest of the table from the marginals, exactly as in the garden example.
| Runs | Does not run | Total | |
|---|---|---|---|
| Swims | x | 0.6 - x | 0.6 |
| Does not swim | 0.5 - x | x - 0.1 | 0.4 |
| Total | 0.5 | 0.5 | 1 |
The bottom-right cell comes from the no-swim row: 0.4 - (0.5 - x) = x - 0.1.
Every cell is a probability, so every cell must be at least 0. That gives four conditions: x \ge 0, 0.6 - x \ge 0, 0.5 - x \ge 0 and x - 0.1 \ge 0. All four hold together exactly when
Both ends can happen. At x = 0.5 every runner also swims. At x = 0.1 the bottom-right cell is 0, so every member does at least one of the two. Every value between gives a valid table too.
So the marginals of a table do not fix its joint probabilities: the same margins fit a whole range of different insides. Information flows one way only. From the joints you can always find the marginals by adding; from the marginals you can recover the joints only when something more is known, such as one cell. One special value in this range, x = 0.6 \times 0.5 = 0.3, is the case where swimming and running are independent.
Boundaries
- The denominator is the grand total. Every joint and marginal probability in this lesson divides by N, because the member is drawn from the whole group. A fraction such as \displaystyle \frac{44}{80}, the first-class returns out of the first-class passengers only, answers a different question: the chance of a return given that the passenger is in first class. That is a conditional probability, the subject of finding a conditional probability.
- The categories must not overlap and must cover everyone. “A marginal is the sum of its joints” needs each member counted in exactly one cell of its row. If a survey lets people tick more than one box (a person who plays both soccer and tennis appears in two columns), the cells of a row can add to more than the number of people in it, and the cell probabilities no longer add to 1.
- The probability describes the table’s own group. A joint or marginal probability read from a table is exact for one member drawn at random from those N. Used for a person outside the table, such as a passenger on some other crossing, it is only an estimate from data, an experimental probability.
- “Or” is not a single cell or a single total. “A and B” is one cell, but “A or B” covers a whole row and a whole column together, and adding P(A) to P(B) counts the cell for “A and B” twice. Handling that overlap is the next lesson, the general addition rule.
Where this goes next
Joint and marginal probabilities are the raw materials of nearly everything else done with a two-way table. Dividing a joint probability by a marginal gives the probability of one category among only the members of another, the subject of finding a conditional probability. Adding two marginals and taking away the joint probability they share gives the probability of “A or B”, which is the general addition rule. And comparing a joint probability with the product of its two marginals is how a table shows whether two variables are independent.
Exercises
Reading a table
A phone repair shop records the fault and the age of each of the 250 phones it repaired last month: “newer” means under 2 years old, “older” means 2 years old or more. Use this table for exercises 1 to 6. In each, one of the 250 phones is chosen at random.
| Newer | Older | Total | |
|---|---|---|---|
| Screen | 60 | 45 | 105 |
| Battery | 15 | 70 | 85 |
| Other | 25 | 35 | 60 |
| Total | 100 | 150 | 250 |
- Find the probability that the phone is under 2 years old and needed a new screen.
- Find the probability that the phone had a battery fault.
- Find the probability that the phone is 2 years old or more.
- Find the probability that the phone is 2 years old or more and had an “other” fault.
- Find the probability that the phone needed a new screen. Is this a joint or a marginal probability?
- Build the joint probability table for the repair shop, and check one row and one column.
Joint probability tables
- A student is chosen at random from a school. The probability that the student plays an instrument and is in the drama club is 0.12, the probability of playing an instrument is 0.35, and the probability of being in the drama club is 0.20. Complete the joint probability table and find the probability that the student does neither.
- A visit to a website is chosen at random and sorted by device (phone or computer) and time of day (morning, afternoon or evening). Given P(\text{phone and morning}) = 0.10, P(\text{phone and afternoon}) = 0.25, P(\text{computer and evening}) = 0.15, P(\text{phone}) = 0.45 and P(\text{afternoon}) = 0.40, complete the joint probability table.
- Each list gives the four cells of a 2 \times 2 table. Say which could be a joint probability table and why. (a) 0.30, 0.20, 0.25, 0.30. (b) 0.40, 0.35, -0.05, 0.30. (c) 0.15, 0.35, 0.20, 0.30.
- In the joint probability table for the entrants to a sports day, one cell holds 0.15, and that cell stands for 27 entrants. How many entrants are there, and how many does a cell holding 0.40 stand for?
Combining cells, and what the margins allow
- From the repair shop table, find the probability that a phone chosen at random is under 2 years old and had a screen or a battery fault.
- From the repair shop table, find the probability that a phone chosen at random is 2 years old or more and did not have an “other” fault.
- From your table in exercise 7, find the probability that a student chosen at random does exactly one of the two: plays an instrument or is in the drama club, but not both.
- Events A and B have P(A) = 0.7 and P(B) = 0.4, and nothing else is known. What values can P(A \text{ and } B) take?
- Events A and B have P(A) = 0.5, P(B) = 0.3 and P(A \text{ and } B) = 0.1. Using a joint probability table, find the probability that neither happens.
Reasoning
- Explain why the bottom-right corner of every joint probability table is 1.
- Someone reads the ferry table and says the probability of a first-class return is \displaystyle \frac{44}{80}. What question does \displaystyle \frac{44}{80} answer, and why is it not the joint probability?
- Write two different 2 \times 2 joint probability tables that both have P(A) = 0.5 and P(B) = 0.5. What does this show about the marginals and the joints?
- A survey asks people to tick every sport they play, soccer or tennis or both, and records the ticks in a table with age group as rows and sport as columns. Explain why the row totals of this table need not be the numbers of people in each age group.
- Explain why a joint probability can never be larger than the marginal probability of its row, or of its column.
Answers
- \displaystyle \frac{60}{250} = 0.24. The cell for newer and screen, over the grand total.
- \displaystyle \frac{85}{250} = 0.34. The battery row total, over the grand total.
- \displaystyle \frac{150}{250} = 0.60. The older column total.
- \displaystyle \frac{35}{250} = 0.14. The cell for older and other.
- \displaystyle \frac{105}{250} = 0.42. It is a marginal probability: it is about the fault only, read from a row total, with nothing said about the age.
- Divide every entry by 250. Newer column: screen 0.24, battery 0.06, other 0.10, total 0.40. Older column: screen 0.18, battery 0.28, other 0.14, total 0.60. Row totals: screen 0.42, battery 0.34, other 0.24; corner 1. Check down the newer column: 0.24 + 0.06 + 0.10 = 0.40. Check across the screen row: 0.24 + 0.18 = 0.42.
- P(\text{neither}) = 0.57. Instrument but no drama club: 0.35 - 0.12 = 0.23. Drama club but no instrument: 0.20 - 0.12 = 0.08. No instrument: 1 - 0.35 = 0.65, so neither is 0.65 - 0.08 = 0.57. Check down the not-in-drama-club column: 0.23 + 0.57 = 0.80 = 1 - 0.20.
- Phone and evening: 0.45 - 0.10 - 0.25 = 0.10. Computer and afternoon: 0.40 - 0.25 = 0.15. P(\text{computer}) = 1 - 0.45 = 0.55, so computer and morning is 0.55 - 0.15 - 0.15 = 0.25. Then P(\text{morning}) = 0.10 + 0.25 = 0.35 and P(\text{evening}) = 0.10 + 0.15 = 0.25; the times of day add to 0.35 + 0.40 + 0.25 = 1. In full, the phone row reads 0.10, 0.25, 0.10 with total 0.45, and the computer row reads 0.25, 0.15, 0.15 with total 0.55.
- Only (c). In (a) the cells add to 1.05, not 1. In (b) they add to 1, but -0.05 is not a probability. In (c) every cell is between 0 and 1 and they add to 1.
- 180 entrants and 72 entrants. Since \displaystyle \frac{27}{N} = 0.15, \displaystyle N = \frac{27}{0.15} = 180, and 0.40 \times 180 = 72.
- \displaystyle \frac{60 + 15}{250} = \frac{75}{250} = 0.30. Two cells of the newer column, added.
- \displaystyle \frac{45 + 70}{250} = \frac{115}{250} = 0.46. The screen and battery cells of the older column.
- 0.23 + 0.08 = 0.31. The two cells off the diagonal: instrument without drama club and drama club without instrument.
- 0.1 \le P(A \text{ and } B) \le 0.4. With x = P(A \text{ and } B) the other cells are 0.7 - x, 0.4 - x and, from the not-A row, 0.3 - (0.4 - x) = x - 0.1. All four are at least 0 exactly when 0.1 \le x \le 0.4.
- 0.3. A and not B: 0.5 - 0.1 = 0.4. B and not A: 0.3 - 0.1 = 0.2. Not A: 1 - 0.5 = 0.5, so neither is 0.5 - 0.2 = 0.3.
- The corner is the grand total divided by the grand total, \displaystyle \frac{N}{N} = 1. Put another way, it is the probability that the member drawn is somewhere in the group, which is certain.
- \displaystyle \frac{44}{80} is the fraction of the first-class passengers who hold a return: the chance of a return given that the passenger is in first class, a conditional probability. The joint probability is about a passenger drawn from all 400, so it divides by 400: \displaystyle \frac{44}{400} = 0.11.
- For example, 0.25 in all four cells, or 0.5 for “A and B”, 0.5 for “neither” and 0 in the other two cells. Both have every row and column summing to 0.5. The same marginals can sit around different joints, so the marginals alone do not determine the joint probabilities.
- A person who plays both sports puts a tick in both columns of the row, so that person is counted twice in the row total. The categories overlap, so the row total counts ticks, not people, and can be larger than the number of people in the age group.
- The cell for “A and B” is one of the cells that add up to row A’s total, and every cell is at least 0, so the cell can be no larger than the total. Dividing both by N gives P(A \text{ and } B) \le P(A). The same holds down column B, so P(A \text{ and } B) \le P(B).