Edit the joint table and watch the row and column totals (the marginals) update. Click a row or column heading to condition on it: the bars show the conditional distribution next to the marginal. The cards below test independence and compare P(A | B) with P(B | A).
← All labsBased on Chapter 1, Probability and Uncertainty, of Polson and Sokolov, Bayes, Artificial Intelligence, and Deep Learning (vsokolov.org/html/_book).
If X and Y are independent, every cell equals its row total times its column total. The third table shows how far each actual cell is from that product.
| P(A and B) | – |
| P(A) | – |
| P(B) | – |
| Base-rate ratio P(A) / P(B) | – |
Every probability in this topic can be read off one joint table. The joint is a cell, a marginal is a row or column total, and a conditional is one row or column rescaled so it adds to 1.
The cell in row X = 3, column Y = 2 holds P(X = 3, Y = 2) = 0.14. Of all people, 14% are very high earners who also report high happiness.
The row total P(X = 3) = 0.01 + 0.09 + 0.14 = 0.24 ignores happiness. The column total P(Y = 2) = 0.46 ignores salary.
Knowing X = 3 removes every other row. Dividing the row by its total gives P(Y = 2 | X = 3) = 0.14 / 0.24 = 0.583. That beats 0.46, so very high earners are more likely to report high happiness.
If every row, once rescaled, looked like the marginal row, X would tell you nothing about Y. Then each cell equals P(x)·P(y). Two fair coin tosses pass this test exactly. Happiness and salary do not.
Takeaway for students. P(A | B) and P(B | A) share the same numerator, P(A and B). They divide it by different totals. When one event is rare, such as playing in the NBA, the two conditionals can sit at opposite ends of the scale. Mixing them up is the prosecutor's fallacy.