Analyze Phase

Chi-Square Test of Independence (Contingency Tables)

The chi-square test of independence is a hypothesis test that checks whether two categorical variables are related, using counts in a contingency table. The chi-square test compares each observed count with the count expected if the variables were independent, and sums the squared gaps, scaled by the expected counts, into one χ² statistic.

Quick facts

Type
Hypothesis test for two categorical variables (attribute data)
Origin
Karl Pearson (1900)
Formula
χ² = Σ (O − E)² / E, E = row total × column total / grand total
Degrees of freedom
(rows − 1) × (columns − 1)
Condition
Expected counts of at least 5 per cell (common rule); no continuity correction in this guide
Reference
IASSC™ Green Belt Body of Knowledge §3.5.8
Exam relevance
Green Belt (Analyze phase); expected counts, χ² and degrees of freedom
Chi-Square Test of Independence (Contingency Tables)Cross-tabulate the counts: rows = one variable, columns = the other; counts, not percentages. Compute expected counts: E = row total × column total / grand total. Check expected counts ≥ 5: merge sparse categories or collect more data if not. Sum (O − E)² / E: one contribution per cell; their total is χ². df = (r − 1)(c − 1): then compare with the χ² table or read the p-value. Read the largest contributions: they show where the association lies1Cross-tabulate the counts2Compute expected counts3Check expected counts ≥ 54Sum (O − E)² / E5df = (r − 1)(c − 1)6Read the largestcontributions

At a glance

  1. Cross-tabulate the counts — rows = one variable, columns = the other; counts, not percentages
  2. Compute expected counts — E = row total × column total / grand total
  3. Check expected counts ≥ 5 — merge sparse categories or collect more data if not
  4. Sum (O − E)² / E — one contribution per cell; their total is χ²
  5. df = (r − 1)(c − 1) — then compare with the χ² table or read the p-value
  6. Read the largest contributions — they show where the association lies

When do you use a chi-square test of independence?

Use the chi-square test of independence when both the X and the Y are categorical and the data are counts. Typical Analyze-phase questions:

  • Does the complaint category depend on the channel the customer used?
  • Is the claim outcome (approved, partly approved, rejected) related to the sales channel?
  • Does the share of late, on-time and missed lab orders differ between day and night shifts?

The data go into a contingency table, with the categories of one variable as rows and the other as columns. H₀ says the two variables are independent: the distribution of the Y is the same in every row. Hₐ says they are associated.

The test generalizes the two-proportion test to any number of groups and outcome categories. For a 2 × 2 table, it gives the same answer as the pooled two-proportion z-test, with χ² = z².

If the Y is continuous, such as a time or a cost, use a t-test or ANOVA instead: classifying times into bands discards information.

The chi-square test of independence is the tool for verifying an X when both the cause and the effect are categories.

How do you calculate the chi-square statistic?

Three formulas do all the work:

  • E = row total × column total / grand total
  • χ² = Σ (O − E)² / E, summed over every cell
  • df = (r − 1)(c − 1)

Worked example. Kestrel Retail classifies 300 customer contacts by channel and by whether the issue was resolved at first contact.

ChannelResolvedNot resolvedTotal
Store9030120
Web chat7030100
Phone404080
Total200100300

Expected counts and contributions (rounded to two decimals for display; χ² computed unrounded):

CellE(O − E)² / E
Store, resolved120 × 200 / 300 = 80.001.25
Store, not resolved120 × 100 / 300 = 40.002.50
Web chat, resolved66.670.17
Web chat, not resolved33.330.33
Phone, resolved53.333.33
Phone, not resolved26.676.67
Totalχ² = 14.25

With df = (3 − 1)(2 − 1) = 2, the critical value at α = 0.05 is 5.991 (formula sheet χ² table). Since 14.25 > 5.991, H₀ is rejected (p ≈ 0.001).

Calculating the chi-square statistic takes one expected count and one contribution per cell, and nothing more.

How do you read the result of a chi-square test?

A significant χ² says that the two variables are associated, not where or why. Three readings complete the picture:

  • The contributions. The largest (O − E)² / E values show which cells drive the result. At Kestrel Retail, the phone row contributes 10.00 of the 14.25: phone contacts are resolved at first contact far less often than expected (40 against 53.33).
  • The row percentages. First-contact resolution is 75% in store, 70% on web chat and 50% on the phone. Percentages make the result readable for the sponsor.
  • The practical size of the gap. A 25-point drop on the phone channel is worth investigating; a significant but tiny difference in a huge sample may not be.

Association is not causation. Phone contacts may involve harder issues, and the channel may only be a proxy for complexity. The team should check that before changing the phone process, for example by stratifying by issue type.

A chi-square result is fully read only when the contributions point to the cells behind the association.

What must be true before you use a chi-square test?

The χ² statistic follows the chi-square distribution only approximately, so the test needs:

  1. Counts, not percentages or rates. Percentages hide the sample size; the same 50% means different things for 4 and 400 units.
  2. Independent observations. Each unit appears in exactly one cell. Repeated classifications of the same units need other methods.
  3. Large enough expected counts. A common rule asks for an expected count of at least 5 in every cell; a more lenient version, after Cochran, accepts up to 20% of cells below 5 if none is below 1. The rule applies to the expected counts, not the observed ones. When it fails, merge sparse categories or collect more data; for small 2 × 2 tables, Fisher's exact test is the alternative.

This guide follows the convention of computing χ² without a continuity correction. Yates' correction subtracts 0.5 from each |O − E| in 2 × 2 tables; it makes the test more conservative, and some texts and calculators apply it by default, so state which version you report.

When the counts are large and the observations independent, the chi-square test of independence gives a reliable answer for any size of table.

What are the common mistakes with the chi-square test?

The chi-square test is popular because it handles any number of categories with simple arithmetic. Its frequent errors are:

  • Wrong degrees of freedom. df is (r − 1)(c − 1), not the number of cells minus one. A 3 × 4 table has 6 df, not 11 or 12.
  • Wrong expected counts. Each E uses its own row and column totals. Using the observed count, or the other row's total, breaks the test.
  • Summing only part of the table. Every cell contributes, including the "good" outcome column.
  • Applying the expected-count rule to observed counts. A cell with an observed 2 can be fine if its expected count is above 5.
  • Running it on percentages. Convert back to counts first.
  • Reading association as cause. A related third factor may drive both variables.

Most chi-square errors come from the table set-up, so check the totals, the expected counts and the degrees of freedom before reading the p-value.

Chi-square test of independence vs. two-proportion test: what is the difference?

Chi-square test of independenceTwo-proportion test
Table sizeAny r × c tableTwo groups, two outcomes (2 × 2)
Statisticχ² = Σ (O − E)² / EPooled z
HypothesesNon-directional onlyOne-sided or two-sided
OutputOverall association plus cell contributionsThe difference between two proportions
2 × 2 caseχ² = z² (no continuity correction)Same p-value as the chi-square test, two-sided

For a 2 × 2 table the two tests agree. The chi-square test handles larger tables; the two-proportion test adds direction and a direct estimate of the difference.

Exam focus

The chi-square test of independence is IASSC™ section 3.5.8, in Green Belt scope only. Expect to compute an expected count, a χ² statistic for a small table and its degrees of freedom, and to know the remedy when expected counts fall below 5. The usual traps are counting cells minus one as df, summing only one column and applying the rule to observed counts. Practise in the Analyze phase drill.

Practise this DMAIC phase →

FAQ

How do I calculate the expected count in a chi-square test?

Multiply the cell's row total by its column total and divide by the grand total. For a row of 100 units, a column of 40 and a grand total of 250, the expected count is 100 × 40 / 250 = 16.0. It is the count you would see if the two variables were independent.

How many degrees of freedom does a chi-square test of independence have?

Multiply the number of rows minus one by the number of columns minus one: df = (r − 1)(c − 1). A 2 × 2 table has 1 degree of freedom and a 3 × 4 table has 6. The number of cells minus one is the df of a goodness-of-fit test, not of a test of independence.

What should I do if expected counts are below 5?

Merge categories that make sense together, such as two rare complaint types, or collect more data until the expected counts reach about 5 per cell. For a small 2 × 2 table, Fisher's exact test is an alternative. Never replace the expected counts with the observed ones.

What is the difference between a chi-square test of independence and a goodness-of-fit test?

The test of independence checks whether two categorical variables are related, using a two-way table and (r − 1)(c − 1) degrees of freedom. A goodness-of-fit test checks whether one variable's counts match a target distribution, such as equal shares across weekdays, with the number of categories minus one degrees of freedom.

Does a significant chi-square test prove that one variable causes the other?

No. It shows that the variables are associated in the data. A third factor, such as issue complexity, customer type or season, may drive both. Confirm a suspected cause with stratified data, process knowledge or a pilot before acting on it.

Sources

Last reviewed

Six Sigma is a registered trademark of Motorola Trademark Holdings, LLC. IASSC™, International Association for Six Sigma Certification™, IASSC Certified Green Belt™ and IASSC Certified Yellow Belt™ are trademarks of the International Association for Six Sigma Certification. ASQ® and its certification names belong to ASQ. Other names may be trademarks of their respective owners. This guide is independent and is not affiliated with, endorsed by or sponsored by IASSC™, PeopleCert, ASQ® or any certifying body. Its practice questions are original and are not taken from any exam.