# Conditional probability and the 2×2 table

> P(A | B) as a share inside a row, precision, recall and accuracy, relative risk and the odds ratio, and why the direction of a condition matters.

- Course: [Math for Statistics and Unit Economics](https://productovi.com/courses/math-basics.md)
- Module: Probability and distributions
- Lesson 26/36, ~26 min
- Source: https://productovi.com/courses/math-basics/conditional-probability

## "Given that"

**Alex Tutor:** You're still on Klasna's product team. Its data team built a model that flags Club members who are likely to cancel, so support can call them first. Last month, 1,000 members, 80 cancelled. The model flagged 120 people, and 48 of those cancelled.

**Sofia:** So the chance of cancelling went from 8% to 40% once someone is flagged?

**Alex Tutor:** That’s the idea of a **conditional probability**. P(cancel) = 80 ÷ 1,000 = 0.08 for everyone. P(cancel | flagged), read "given flagged", looks only at the 120 flagged: 48 ÷ 120 = 0.40.

$$
P(A \mid B) = \frac{P(A \text{ and } B)}{P(B)}
$$

*The condition B shrinks the denominator to the cases where B is true.*

**Alex Tutor:** In shares of the whole: 48 of 1,000 are flagged and cancelled, 0.048; 120 of 1,000 are flagged, 0.12. 0.048 ÷ 0.12 = 0.40, the same answer.

> **Exercise:** Of the 880 members the model did not flag, 32 cancelled. What is P(cancel | not flagged), in percent, to one decimal?

## The 2×2 table

**Alex Tutor:** Put it all in a table. Rows: what the model said. Columns: what happened. Four cells: 48 hits, 72 false alarms, 32 missed cancellations and 848 correct "no"s.

**Alex Tutor:** First, fill the table yourself from what we know.

> **Exercise:** Klasna’s churn model last month: 1,000 Club members, 80 of them cancelled; the model flagged 120, and 48 of the flagged cancelled. How many members were neither flagged nor cancelled?

![In the 2×2 table, precision reads the flagged row (48 of 120 = 0.40) and recall reads the cancelled column (48 of 80 = 0.60).](https://productovi.com/courses/math-basics/diagrams/m7-l2-confusion-grid.png)

*Same 48 in the numerator, a different denominator each time.*

**Alex Tutor:** **Precision** reads the row: of those flagged, how many cancelled? TP ÷ (TP + FP) = 48 ÷ 120 = 0.40. **Recall** reads the column: of those who cancelled, how many we flagged? TP ÷ (TP + FN) = 48 ÷ 80 = 0.60.

**Sofia:** And accuracy counts every correct cell?

**Alex Tutor:** Yes: (48 + 848) ÷ 1,000 = 0.896. Now a model that flags nobody: it’s right about all 920 who stayed, so accuracy 0.92, higher than ours, and it never catches a single cancellation.

**Sofia:** So when the event is rare, accuracy mostly counts the easy "no"s.

**Alex Tutor:** Exactly. That’s why teams that act on a flag look at precision (how many calls are wasted) and recall (how many cancellations slip past), not at accuracy.

> **Exercise:** Match each number to the question it answers about the churn model.

**Alex Tutor:** Now the model that flags nobody, in numbers.

> **Exercise:** Cancelling is rare in Klasna Club: 80 of 1,000 members a month. A lazy model flags nobody at all. What are its accuracy and recall?

> **Exercise:** A second model flags 300 members and catches 72 of the 80 who cancel. Its recall is higher than the first model’s, and its precision is lower.

## The direction of the condition

**Sofia:** Wait. P(cancel | flagged) is 0.40, and P(flagged | cancel) is 0.60. Same two events, different numbers?

**Alex Tutor:** Because the denominators differ: 120 flagged vs 80 who cancelled. Swapping the condition is the most common probability mistake. The p-value is one: it’s P(data this extreme | no real effect), not P(no real effect | data).

**Alex Tutor:** Some test reports say "B is better with 59% probability". That’s P(B better | data) = 0.59: barely more than a coin toss. It doesn’t mean B is 59% better, or that 59% of users prefer B.

> **Exercise:** A test report says: "Probability that variant B beats A: 59%." What is the right reading?

## Comparing two groups

**Alex Tutor:** One more use of the 2×2 table. Some trial learners got a short goal-setting call: 105 of 300 bought. Without the call, 125 of 500 bought. So 0.35 against 0.25.

**Alex Tutor:** The **relative risk** divides the two probabilities: 0.35 ÷ 0.25 = 1.40. The **odds ratio** divides the odds, yes ÷ no: (105 ÷ 195) ÷ (125 ÷ 375) = 0.538 ÷ 0.333 ≈ 1.62. In the table’s letters that is ad ÷ bc.

**Alex Tutor:** Try the relative risk on another Klasna test first.

> **Exercise:** Klasna tried lesson reminders. Of 400 learners who got one, 90 skipped a lesson that month; of 500 who didn’t, 150 skipped. What is the relative risk of skipping, reminder vs no reminder? Two decimals.

![With a call 105 of 300 bought (0.35), without 125 of 500 (0.25): relative risk 1.40, odds ratio about 1.62, further from 1.](https://productovi.com/courses/math-basics/diagrams/m7-l2-rr-or.png)

*Two honest ways to compare the groups; always say which one you report.*

**Sofia:** Why is the odds ratio bigger?

**Alex Tutor:** Odds stretch faster than probabilities as p grows. For rare events, say 2% vs 1%, the two almost agree. Logistic regression reports odds ratios, so read them as "the odds are 1.62 times", never as "1.62 times as likely".

> **Exercise:** Of 200 Club members who joined a speaking club in their first week, 30 cancelled in month one. Of 600 who didn’t, 150 cancelled. What is the odds ratio of cancelling, joined vs not joined? Two decimals.

## Your turn

**Alex Tutor:** Last check. A draft slide about the churn model says: "The model is 89.6% accurate, so 9 in 10 members it flags will cancel."

> **Exercise:** A draft slide about the churn model says: "The model is 89.6% accurate, so 9 in 10 members it flags will cancel." In two or three sentences, say what is wrong with the slide and which number should replace the claim. Use the table: 48 hits, 72 false alarms, 32 missed, 848 correct "no"s.

## Where you will meet this

> **In short**
>
> - **P(A | B)** = P(A and B) ÷ P(B): count only the cases where B is true.
> - **Precision** = TP ÷ (TP + FP), the flagged row. **Recall** = TP ÷ (TP + FN), the real-positive column. **Accuracy** = correct ÷ all, and it flatters rare events.
> - P(A | B) ≠ P(B | A). A p-value conditions on "no effect".
> - **Relative risk** = p₁ ÷ p₂; **odds ratio** = (a ÷ b) ÷ (c ÷ d) = ad ÷ bc, further from 1.

> **These lessons use it**
>
> - [p-value and statistical significance](/courses/statistics-for-pm-and-marketers/p-value): a probability given that there is no effect.
> - [Logistic regression and classification](/courses/statistics-for-pm-and-marketers/logistic-regression): odds ratios, the confusion matrix, precision and recall.
> - [Course recap: choosing the right test](/courses/statistics-for-pm-and-marketers/choosing-the-right-test): 2×2 tables of counts.
> - [A/B test plan: hypothesis, metrics, guardrails](/courses/product-analytics/test-design): false alarms and missed effects.
> - [Case: reading a finished test](/courses/product-analytics/reading-a-test): what a test result does and doesn’t say.

**Alex Tutor:** Next time: expected value, or how to weigh outcomes by how likely they are.

- Previous lesson: [p and 1 − p](https://productovi.com/courses/math-basics/p-and-1-minus-p.md)
- Next lesson: [Expected value and scenarios](https://productovi.com/courses/math-basics/expected-value.md)

---
Productovi Learning. Free, no sign-up needed to read.
