01 / 21

Expected Counts in
Two-Way Tables

Learn how to calculate the expected frequency for each cell under the assumption of independence, and why it matters for the chi-square test.

AP Statistics

What Is a Two-Way Table?

A two-way table (also called a contingency table) displays the frequency counts for two categorical variables. Rows represent one variable, columns represent another, and each cell shows how many observations fall into that combination.

Prefer Dogs Prefer Cats Total
Male 36 24 60
Female 30 10 40
Total 66 34 100

Observed vs. Expected Counts

Observed Count
The actual frequency recorded in your data for a particular cell. This is what you see in the raw table.
Expected Count
The theoretical frequency you would expect in a cell if the two variables were completely independent of each other.

Why Independence Matters

Two categorical variables are independent if knowing the value of one variable tells you nothing about the other. Under independence, the proportion in each row should match the overall column proportion, and vice versa.

Dependent A B Proportions differ across rows Association exists Independent A B Proportions are the same across rows No association

The Expected Count Formula

$$E = \frac{(\text{row total}) \times (\text{column total})}{\text{grand total}}$$

For any cell in a two-way table, its expected count is calculated by multiplying its row total by its column total, then dividing by the grand total (the total number of observations).

Formula in Formal Notation

$$E_{ij} = \frac{R_i \times C_j}{n}$$
\( E_{ij} \)
Expected count for row \( i \), column \( j \)
\( R_i \)
Total count in row \( i \) (marginal row total)
\( C_j \)
Total count in column \( j \) (marginal column total)
\( n \)
Grand total of all observations in the table

Marginal vs. Joint vs. Conditional

Marginal Joint Conditional
Definition Totals in one variable only Count in a specific cell Proportion within a row or column
Location Row/column totals (margins) Interior cells Calculated from interior cells
Example "60 males total" "36 males prefer dogs" "60% of males prefer dogs"
Used in formula \( R_i \) and \( C_j \) Observed \( O_{ij} \) Not directly

How to Calculate Expected Counts

1
Compute marginal totals. Sum each row and each column. Sum all cells to get the grand total \( n \).
2
Identify the cell. Note which row \( i \) and column \( j \) the cell belongs to.
3
Multiply: \( R_i \times C_j \). This gives the product of row total and column total for that cell.
4
Divide by \( n \): \( E_{ij} = \frac{R_i \times C_j}{n} \). The result is the expected count.
5
Repeat for every cell. Then verify that each row and column of expected counts sums to its marginal total.

Worked Example: Pet Preference

Using our earlier table, find the expected count for "Male and Prefer Dogs."

Dogs Cats Total
Male 36 24 60
Female 30 10 40
Total 66 34 100

Complete Expected Counts Table

Apply the formula to every cell:

Dogs Cats Total
Male \(\frac{60 \times 66}{100} = 39.6\) \(\frac{60 \times 34}{100} = 20.4\) 60
Female \(\frac{40 \times 66}{100} = 26.4\) \(\frac{40 \times 34}{100} = 13.6\) 40
Total 66 34 100

Worked Example 2: Study Habits

A survey of 200 students recorded their grade level and preferred study method:

Alone Group Tutor Total
Freshman 30 20 10 60
Sophomore 25 35 20 80
Junior 20 25 15 60
Total 75 80 45 200

Full Expected Table for Study Habits

Alone Group Tutor Total
Freshman 22.5 24 13.5 60
Sophomore 30 32 18 80
Junior 22.5 24 13.5 60
Total 75 80 45 200

Connecting to the Chi-Square Statistic

Expected counts are essential because they feed directly into the chi-square test statistic:

$$\chi^2 = \sum \frac{(O_{ij} - E_{ij})^2}{E_{ij}}$$
\( O_{ij} \)
Observed count in cell \( (i, j) \)
\( E_{ij} \)
Expected count in cell \( (i, j) \)
\( \chi^2 \)
Measures total deviation from independence

Conditions Involving Expected Counts

Before performing a chi-square test, you must verify that all expected counts are large enough for the approximation to be valid:

1
All expected counts \( \geq 5 \). This is the standard AP Statistics condition. Every single cell must meet this threshold.
2
Random sample or random assignment. The data must come from a valid random process.
3
Independent observations. For sampling, the sample size should be < 10% of the population (10% condition).

Common Mistakes to Avoid

✕ Using Observed Counts
The "\( \geq 5 \)" condition applies to expected counts, not observed counts. Always check expected values.
✕ Wrong Totals in Formula
Using the grand total in place of a row or column total, or mixing up which total goes with which cell.
✕ Rounding Too Early
Expected counts can be decimals like 13.6. Do not round to whole numbers: use the exact value in the \( \chi^2 \) formula.

Summary Comparison

Observed Counts Expected Counts
Source Collected from data Calculated from formula
Values Always whole numbers Often decimals
Assumption None: raw reality Variables are independent
Formula N/A (given in table) \( \frac{R_i \times C_j}{n} \)
Role in \( \chi^2 \) \( O \) in \( \frac{(O - E)^2}{E} \) \( E \) in \( \frac{(O - E)^2}{E} \)
Condition check Not checked All cells must be \( \geq 5 \)

Worked Example

A university admissions office wants to investigate whether admission status (Admitted, Denied) is associated with the applicant's intended major (Engineering, Business, Liberal Arts). A random sample of 400 applicants yields the following observed counts. | Engineering | Business | Liberal Arts | Row Total Admitted | 80 | 60 | 100 | 240 Denied | 40 | 60 | 60 | 160 Col Total | 120 | 120 | 160 | 400 Computing Expected Counts & Chi-Square Statistic Step 1 — Identify Marginal Totals Row totals: Admitted = 240, Denied = 160. Column totals: Engineering = 120, Business = 120, Liberal Arts = 160. Grand total n = 400. Step 2 — Compute Expected Counts Apply E_(ij) = (R_(i) × C_(j)) / n for each cell. Admitted-Engineering: (240 × 120)/400 = 72. Admitted-Business: (240 × 120)/400 = 72. Admitted-Liberal Arts: (240 × 160)/400 = 96. Denied-Engineering: (160 × 120)/400 = 48. Denied-Business: (160 × 120)/400 = 48. Denied-Liberal Arts: (160 × 160)/400 = 64. Expected counts: 72, 72, 96, 48, 48, 64 — all ≥ 5 ✓ Step 3 — Verify Marginal Sums Admitted row: 72 + 72 + 96 = 240 ✓. Denied row: 48 + 48 + 64 = 160 ✓. Engineering column: 72 + 48 = 120 ✓. Business column: 72 + 48 = 120 ✓. Liberal Arts column: 96 + 64 = 160 ✓. Step 4 — Compute Chi-Square Contributions For each cell, compute (O − E)² / E. Admitted-Eng: (80 − 72)² / 72 = 64/72 ≈ 0.889. Admitted-Bus: (60 − 72)² / 72 = 144/72 = 2.000. Admitted-LA: (100 − 96)² / 96 = 16/96 ≈ 0.167. Denied-Eng: (40 − 48)² / 48 = 64/48 ≈ 1.333. Denied-Bus: (60 − 48)² / 48 = 144/48 = 3.000. Denied-LA: (60 − 64)² / 64 = 16/64 = 0.250. Step 5 — Sum and Interpret χ² = 0.889 + 2.000 + 0.167 + 1.333 + 3.000 + 0.250 = 7.639. Degrees of freedom: (2 − 1)(3 − 1) = 2. Using a chi-square distribution with df = 2, the p-value is approximately 0.022. At α = 0.05, we reject the null hypothesis and conclude that there is statistically significant evidence of an association between admission status and intended major. χ² = 7.639, df = 2, p ≈ 0.022 → Reject H₀ at α = 0.05 Separate 2,000-applicant illustration: an expected count here is 500×780/2000=195. Preserve the original 400-observation table with expected rows [72,72,96] and [48,48,64].

The same 150 admitted engineering applicants compared with denominators 780 admitted applicants and 500 engineering applicants, giving about 19.2% and 30%.
Applicant cohorts of 1200,500,300 with admitted counts 480,150,150 and other counts 720,350,150.
Applicant cohorts of 1200,500,300 with admitted counts 480,150,150 and other counts 720,350,150.

Question 1 of 5

In a two-way table with a grand total of 150, a particular row total is 50 and the corresponding column total is 90. What is the expected count for that cell?

Question 2 of 5

Which condition must be satisfied by expected counts before performing a chi-square test?

Question 3 of 5

A two-way table has row totals of 40 and 60, and column totals of 55 and 45. The grand total is 100. What is the expected count for the cell in row 1, column 2?

Question 4 of 5

If the observed count in a cell is 28 and the expected count is 20, what is the contribution of this cell to the chi-square statistic?

Question 5 of 5

Two rows in a two-way table have the same row total. Which of the following must be true about their expected counts?