Introduction to Statistics · Chapter 3 · Probability Topics
Sort one sample by two variables at once, and read every probability in this chapter — P(A), P(A AND B), P(A OR B), P(A∣B) — straight off the counts.
bookSHelf · Introduction to Statistics · §3.4 · a self-paced section
Learning objectives — by the end of this section you will be able to
§3.4.1 — one sample, two variables, one table
A contingency table displays a sample classified by two variables at once. Every probability in this section — a single event, an AND, an OR, a conditional — is just a different region of the same table, divided by a different total.
Which total you divide by is the entire game.
§3.4.1 — a display of a sample, two variables at once
Definition 3.4.1 — Contingency Table
A contingency table displays the members of a sample classified simultaneously by two variables. Each row is one value of the first variable, each column one value of the second, and the entry where a row meets a column reports how many sample members have both of those values.
Figure: one sample partitioned by two variables at once — the interior counts are what falls out.
The two variables may be contingent on one another. A table of one variable shows how a sample splits; a contingency table shows whether that split changes depending on where you are in the other variable — exactly the question independence asks.
§3.4.1 — three kinds of number, one table
Definition 3.4.2 — Joint Count, Marginal Total, Grand Total
Joint count — an interior cell: one row and one column at once.
Marginal total — a row total or column total, regardless of the other variable.
Grand total — the whole sample, in the lower-right corner; it equals both the sum of the row totals and the sum of the column totals.
Figure: the same table, three regions, three different denominators.
§3.4.1 — the only ingredients any probability here needs
| Question | Numerator | Denominator |
|---|---|---|
| P(A) | marginal total for A | grand total |
| P(A AND B) | joint count where A's row meets B's column | grand total |
| P(A OR B) | the two margins, minus the joint count once | grand total |
| P(A∣B) | joint count | B's marginal total |
A grand total means "out of everybody"; a row or column total means "out of this group only."
Insight Note — the denominator tells you which question you answered
Read your own denominator back to yourself.
Every one of the four probabilities can use the same interior cell as its numerator — what distinguishes them is the bottom of the fraction. If you ever lose track of which probability you are computing, that is the tell.
Context Pause — why "given" shrinks the world
Once they are standing, you stop looking at the seated crowd.
Ask a lecture hall of 755 people who got a speeding ticket to stand, then ask how many of them use a phone while driving — the 755 is gone, replaced by the standing count. In a table it is literally the act of covering the rest with your hand and reading one row.
Your turn — read a marginal and a conditional off one table
Try It Now 3.4.1 — Table 3.4.1, stretching and injuries (800 athletes)
| Injury | No injury | Total | |
|---|---|---|---|
| Stretches | 55 | 295 | 350 |
| Does not stretch | 231 | 219 | 450 |
| Total | 286 | 514 | 800 |
a. P(stretches)? b. P(stretches∣no injury)?
a. 800350=0.4375 b. 514295≈0.5739
Part b restricts to the 514-athlete column — the numerator 295 and denominator 514 both come from that column; the 800 never appears.
Worked example — six probabilities, one table
| Speeding violation | No violation | Total | |
|---|---|---|---|
| Uses cell phone | 25 | 280 | 305 |
| Does not use cell phone | 45 | 405 | 450 |
| Total | 70 | 685 | 755 |
Table 3.4.2: cell phone use against speeding violations, 755 drivers. 305+450=755 and 70+685=755 — the two marginal breakdowns of the same sample must agree.
a. cell phone user b. no violation c. no violation AND cell phone user d. cell phone user OR no violation e. cell phone user given a violation f. no violation given not a cell phone user
Example 3.4.1 — one table, six different denominators
| Part | Question | Answer |
|---|---|---|
| a | cell phone user | 755305 |
| b | no violation | 755685 |
| c | no violation AND cell phone user | 755280 |
| d | cell phone user OR no violation | 755710 |
| e | cell phone user ∣ violation | 7025 |
| f | no violation ∣ not cell phone user | 450405 |
Parts e and f are conditionals — their denominators (70 and 450) are column and row totals, never the grand total of 755.
§3.4.2 — when a table has holes, and when two events don't care about each other
A contingency table is heavily constrained: every row sums to its row total, every column to its column total, and both sets of totals to the same grand total. Once complete, its counts already contain everything the independence test needs.
Independence is an exact statement — "close" is not "equal."
§3.4.2 — a height comparison
Definition 3.4.3 — Independence Test
Two events A and B in a contingency table are independent exactly when
P(A AND B)=P(A)P(B)
Figure: the joint probability, measured against the product of the margins.
The table's own constraints double as a check: if it arrives with holes, the row/column/grand totals fill them for you before you compute a single probability.
§3.4.2 — the two tests always agree
Joint vs. product
Read the joint count over the grand total on the left; the two marginal totals over the grand total on the right. If the two sides match, the events are independent.
Conditional vs. marginal
Equivalently, compare P(A∣B) with P(A): independence says conditioning on B leaves A's probability alone. Use whichever numbers the table hands you more cheaply.
Insight Note — compute both sides fully before you judge
Close is not equal.
The two sides of the independence test are often close — 0.18 against 0.153 in a worked example ahead — and independence is an exact statement about the population, with no tolerance band. Carry your arithmetic far enough that a real difference cannot hide in a rounding.
Your turn — a conditional, then the independence test
Try It Now 3.4.2 — Table 3.4.3, route preference by age (200 cyclists)
| Age | Lake | Hilly | Wooded | Total |
|---|---|---|---|---|
| Younger | 45 | 38 | 27 | 110 |
| Older | 26 | 52 | 12 | 90 |
| Total | 71 | 90 | 39 | 200 |
a. P(hilly∣older)? b. Are "older" and "hilly" independent?
a. 9052≈0.5778 b. not independent
P(O AND H)=0.26 but P(O)P(H)=(0.45)(0.45)=0.2025 — 0.26=0.2025.
Worked example — complete a table, then test independence
| Sex | Coastline | Lakes/Streams | Mtn. Peaks | Total |
|---|---|---|---|---|
| Women | 18 | 16 | — | 45 |
| Men | — | — | 14 | 55 |
| Total | — | 41 | — | — |
Table 3.4.4: hiking area preference, 100 hikers, partially completed.
a. complete the table b. are "woman" and "coastline" independent? c. P(man∣lakes/streams)? d. P(woman OR mountain peaks)?
Example 3.4.2 — let the totals close the gaps
| Sex | Coastline | Lakes/Streams | Mtn. Peaks | Total |
|---|---|---|---|---|
| Women | 18 | 16 | 11 | 45 |
| Men | 16 | 25 | 14 | 55 |
| Total | 34 | 41 | 25 | 100 |
Table 3.4.5: 45−34=11; 41−16=25; 55−39=16 — each new entry checked against the next constraint, closing at 34+41+25=100.
Example 3.4.2 — three questions off the completed table
b. Not independent
P(F AND C)=0.18
P(F)P(C)=(0.45)(0.34)=0.153
0.18=0.153
c. and d.
P(M∣L)=4125 — sample space is the 41 lakes/streams hikers, not all 100.
P(F OR P)=10045+25−11=10059
Try it in rāSHio
Open Calculators → Probability, switch to Conditional, and enter Table 3.4.5's margins — P(F)=0.45 and P(C)=0.34 — with Assume independence ticked.
The panel returns P(F AND C)=0.153, because ticking that box is exactly the assumption that makes the AND equal the product. That is not the answer — it is the number the table's real 0.18 gets measured against.
Figure 3.4.1 — Calculators → Probability, Conditional mode
Figure 3.4.1: with Assume independence ticked, rāSHio returns the AND as the product of the margins — the number the independence test compares the table's own joint probability against.
§3.4.3 — the same table, holding probabilities instead of counts
Counts are not the only thing a contingency table can hold. In many applied problems probabilities are what you are handed directly, and every rule from the count version carries over unchanged.
Only the grand total is different — it becomes 1.
§3.4.3 — entries that tile the unit interval
Definition 3.4.4 — Probability Contingency Table
A probability contingency table is a contingency table whose interior entries are joint probabilities P(row AND column) rather than counts. Its margins are the marginal probabilities P(row) and P(column), and its lower-right corner is 1 rather than a sample size.
Figure: the six interior entries tile the unit interval exactly — that is why the corner is 1.
P(A∣B) is still an interior entry divided by a margin — just an entry and a margin made of probabilities instead of counts.
Context Pause — the corner is the check digit
The corner must be exactly 1.
Every member of the sample space is in exactly one interior cell, so a probability table's lower-right corner is always 1. If your entries do not sum to 1, find the arithmetic error before computing anything else — the cheapest check in the section.
Your turn — mutually exclusive events, read from the problem
Try It Now 3.4.3 — Andi buys one car
Andi can afford only one of car A or car B. P(A)=0.35, P(B)=0.65. Find a. P(A AND B); b. P(A OR B).
a. 0 b. 1.00
"Only one car" means no overlap: P(A AND B)=0, so P(A OR B)=0.35+0.65−0=1.00 — Andi buys one of the two with certainty.
Worked example — a probability table built from the multiplication rule
| Door One | Door Two | Door Three | Total | |
|---|---|---|---|---|
| Caught | 151 | 121 | 61 | — |
| Not Caught | 154 | 123 | 61 | — |
| Total | — | — | — | 1 |
Table 3.4.6: each door is chosen with probability 31; each entry is a multiplication-rule product, e.g. 151=(51)(31) is P(Door One AND Caught).
a. complete the table, verify the corner is 1 b. P(not caught)? c. P(Door One OR Door Two∣caught)?
Example 3.4.3 — every column totals 31, a built-in check
| Door One | Door Two | Door Three | Total | |
|---|---|---|---|---|
| Caught | 151 | 121 | 61 | 6019 |
| Not Caught | 154 | 41 | 61 | 6041 |
| Total | 31 | 31 | 31 | 1 |
b. P(not caught)=6041. c. Restricted to the 6019 caught margin, Doors One and Two contribute 151+121=609, so P(Door One OR Two∣caught)=199.
§3.4.4 — the entries only had to be additive
Nothing in the machinery of this section required headcounts. Crime rates per 100,000 inhabitants, dollar amounts, hours logged, tonnes shipped — anything you can sum across a row or column and still have it mean something works the same way.
The arithmetic is identical; the sentence you write to interpret it is not.
Insight Note — read the units before you read the numbers
4,520.7 is not 4,520 people.
It is the sum of four years of crime rates per 100,000 inhabitants. The arithmetic for "P(Year 2 AND Robbery)" is identical to the count case, but say "share of the total rate," not "chance that a person."
Your turn — weight and height, seven parts
| Weight / Height | Tall | Medium | Short | Total |
|---|---|---|---|---|
| Overweight | 18 | 28 | 14 | — |
| Typical | 20 | 51 | 28 | — |
| Underweight | 12 | 25 | 9 | — |
| Total | — | — | — | — |
Table 3.4.8: weight category by height category, totals omitted.
a. totals b. P(tall) c. P(overweight AND tall) d. P(tall∣overweight) e. P(overweight∣tall) f. P(tall AND underweight) g. independent?
Try It Now 3.4.4 — same cell, different question, different answer
| W/H | Tall | Med. | Short | Tot. |
|---|---|---|---|---|
| Over | 18 | 28 | 14 | 60 |
| Typ. | 20 | 51 | 28 | 99 |
| Under | 12 | 25 | 9 | 46 |
| Total | 50 | 104 | 51 | 205 |
b. 20550≈0.2439
c. 20518≈0.0878
d. 6018=0.3
e. 5018=0.36
f. 20512≈0.0585
g. not independent: 0.0878=(0.2927)(0.2439)≈0.0714
Worked example — a table of rates, not headcounts
| Year | Robbery | Burglary | Vandalism | Vehicle | Total |
|---|---|---|---|---|---|
| 1 | 145.7 | 732.1 | 29.7 | 314.7 | — |
| 2 | 133.1 | 717.7 | 29.1 | 259.2 | — |
| 3 | 119.3 | 701.0 | 27.7 | 239.1 | — |
| 4 | 113.7 | 702.2 | 26.8 | 229.6 | — |
| Total | — | — | — | — | 4,520.7 |
Table 3.4.10: crimes per 100,000 inhabitants, totals omitted; the grand total is given.
a. P(Year 2 AND Robbery) b. P(Year 3 AND Burglary) c. P(Year 3 OR Burglary) d. P(Year 4∣Vandalism) e. P(Vehicle∣Year 1)
Example 3.4.4 — total once, then every part is a lookup
| Yr | Rob. | Burg. | Van. | Veh. | Tot. |
|---|---|---|---|---|---|
| 1 | 145.7 | 732.1 | 29.7 | 314.7 | 1,222.2 |
| 2 | 133.1 | 717.7 | 29.1 | 259.2 | 1,139.1 |
| 3 | 119.3 | 701.0 | 27.7 | 239.1 | 1,087.1 |
| 4 | 113.7 | 702.2 | 26.8 | 229.6 | 1,072.3 |
| Tot. | 511.8 | 2,853.0 | 113.3 | 1,042.6 | 4,520.7 |
a. 4520.7133.1≈0.0294
b. 4520.7701.0≈0.1551
c. 4520.71087.1+2853.0−701.0≈0.7165
d. 113.326.8≈0.2365
e. 1222.2314.7≈0.2575
Key Terminology — the five terms this section defined
The table itself
contingency table — a display of a sample classified by two variables at once, with rows for one, columns for the other, and counts in the interior cells.
probability contingency table — the same display, holding joint probabilities instead of counts, so its grand total is 1.
Its three regions
joint count — an interior cell; one row and one column at once.
marginal total — a row total or column total, regardless of the other variable.
grand total — the lower-right entry; the whole sample, equal to both sums of margins.
The headline result of §3.4
Independence is a height comparison, not a vibe.
P(A AND B)=P(A)P(B)
Read the joint count and the two margins off the same table, divide each by the grand total, and compare. Every probability in this section — single, AND, OR, conditional — was already sitting in the table; only the denominator changed.
† Equivalently, P(A∣B)=P(A) — conditioning on B leaves A untouched exactly when the two tests agree, which they always do.
§3.4 — conclusions
The core idea
A contingency table is one sample split by two variables. Every probability you need is a region of that table — a joint count, a marginal total, or the grand total — divided by whichever total the question names.
The failure case
A joint probability close to the product of the margins is still dependence, not independence — 0.18 against 0.153 in Example 3.4.2. There is no tolerance band; compute both sides fully before you judge.
Next: §3.5 — Tree and Venn Diagrams, two more ways to picture the same probabilities.