Two-Way Tables Formula

The Formula

P(A|B) = \frac{\text{joint frequency of } A \text{ and } B}{\text{marginal frequency of } B}

When to use: Imagine surveying students about their favorite sport AND their grade level. A two-way table is like a grid: grades go down the side, sports go across the top, and each cell tells you how many students are in that specific combination. The totals on the edges (margins) tell you the overall counts for each category.

Quick Example

| | Soccer | Basketball | Total |
|---|---|---|---|
| **6th** | 15 | 10 | 25 |
| **7th** | 12 | 18 | 30 |
| **Total** | 27 | 28 | 55 |

**Joint:** 15 sixth-graders chose soccer.
**Marginal:** 27 total chose soccer.
**Conditional:** Of 7th-graders, \frac{18}{30} = 60\% chose basketball.

Notation

Joint frequency: count in a single cell. Marginal frequency: row or column total. Conditional frequency: cell \div row (or column) total.

What This Formula Means

A table that displays frequencies for two categorical variables simultaneously, organized with one variable in rows and the other in columns. It shows joint frequencies (individual cells), marginal frequencies (row/column totals), and enables calculation of conditional frequencies.

Imagine surveying students about their favorite sport AND their grade level. A two-way table is like a grid: grades go down the side, sports go across the top, and each cell tells you how many students are in that specific combination. The totals on the edges (margins) tell you the overall counts for each category.

Formal View

P(A \cap B) = \frac{n_{AB}}{n}; P(A|B) = \frac{n_{AB}}{n_B} where n_{AB} is the joint count and n_B is the marginal count for B

Worked Examples

Example 1

medium
A two-way table shows: Smoker/Cancer=30, Smoker/No-Cancer=70, Non-smoker/Cancer=20, Non-smoker/No-Cancer=180. Calculate marginal and joint proportions, and find P(Cancer|Smoker) vs P(Cancer|Non-smoker).

Solution

  1. 1
    Total: 300 people; Smokers=100, Non-smokers=200
  2. 2
    Joint: P(\text{Smoker} \cap \text{Cancer}) = 30/300 = 0.10
  3. 3
    Marginal: P(\text{Cancer}) = 50/300 = 0.167; P(\text{Smoker}) = 100/300 = 0.333
  4. 4
    P(\text{Cancer}|\text{Smoker}) = 30/100 = 0.30; P(\text{Cancer}|\text{Non-smoker}) = 20/200 = 0.10

Answer

P(\text{Cancer}|\text{Smoker}) = 0.30 vs. P(\text{Cancer}|\text{Non-smoker}) = 0.10. Smokers have 3× higher cancer rate.
Two-way tables organize joint and conditional probabilities. Marginal probabilities are row/column totals divided by grand total. Conditional probabilities are cell frequencies divided by row (or column) totals. Comparing P(Cancer|Smoker) to P(Cancer|Non-smoker) reveals the association.

Example 2

hard
From a 2×2 table: Group/Outcome frequencies: A-Success=40, A-Fail=10, B-Success=25, B-Fail=25. Test independence using the chi-square approach and calculate the relative risk.

Common Mistakes

  • Dividing by the grand total when computing conditional frequency instead of dividing by the relevant row or column total
  • Reading the table in the wrong direction: 'of those who chose soccer, what percent are 6th-graders?' is \frac{15}{27}, not \frac{15}{25}
  • Confusing two-way tables with other data displays—two-way tables are specifically for TWO categorical variables

Why This Formula Matters

Two-way tables are fundamental for analyzing relationships between categorical variables—survey analysis, medical studies (treatment vs. outcome), and market research all use them. They are the precursor to chi-squared tests and conditional probability.

Frequently Asked Questions

What is the Two-Way Tables formula?

A table that displays frequencies for two categorical variables simultaneously, organized with one variable in rows and the other in columns. It shows joint frequencies (individual cells), marginal frequencies (row/column totals), and enables calculation of conditional frequencies.

How do you use the Two-Way Tables formula?

Imagine surveying students about their favorite sport AND their grade level. A two-way table is like a grid: grades go down the side, sports go across the top, and each cell tells you how many students are in that specific combination. The totals on the edges (margins) tell you the overall counts for each category.

What do the symbols mean in the Two-Way Tables formula?

Joint frequency: count in a single cell. Marginal frequency: row or column total. Conditional frequency: cell \div row (or column) total.

Why is the Two-Way Tables formula important in Math?

Two-way tables are fundamental for analyzing relationships between categorical variables—survey analysis, medical studies (treatment vs. outcome), and market research all use them. They are the precursor to chi-squared tests and conditional probability.

What do students get wrong about Two-Way Tables?

Distinguishing joint, marginal, and conditional frequencies. Joint = one specific cell. Marginal = row or column total. Conditional = cell divided by its row or column total (not the grand total).

What should I learn before the Two-Way Tables formula?

Before studying the Two-Way Tables formula, you should understand: probability, fractions, ratios.