Statistics

Chi-Square Test of Independence

Students sort two colors and two shapes into a grid of wooden trays.

Chi-Square Test of Independence definition

A chi-square test of independence checks whether two categorical variables are associated in a population.

In Spanish
prueba chi-cuadrado de independencia
Topic
Hypothesis tests and inference

Chi-Square Test of Independence in a picture

Chi-Square Test of Independence diagramA cell with row total 30 and column total 40 in a table of 100 observations has expected count 12.Row total: 30Count observations in that rowColumn total: 40Count observations in that columnExpected count: 30 × 40/100 = 12Use the grand total of 100
A cell with row total 30 and column total 40 in a table of 100 observations has expected count 12.

How it works

Arrange observed counts in a two-way table. Under independence, a cell’s expected count is its row total times its column total divided by the grand total. Add (observed − expected)²/expected across cells. With independent observations and sufficiently large expected counts, use a chi-square reference with (rows − 1)(columns − 1) degrees of freedom.

Worked examples

A row totals 20 and a column totals 15 in a table of 60 observations. Find the expected count.

20 × 15/60 = 5.

Find the degrees of freedom for a 3 by 4 table.

(3 − 1)(4 − 1) = 6.

What does a small p-value suggest when the assumptions hold?

Evidence of an association between the variables. The test does not establish causation.

Common mistake

Use observed counts for the cell data and expected counts for the denominators. Check whether the chi-square approximation is suitable for sparse tables.

Quick check

What is the expected cell count with row total 12, column total 20, and grand total 40?

How many degrees of freedom are in a 2 by 2 table?

Show answer

1.

What is the null hypothesis?

Show answer

The two categorical variables are independent.

Sources

Flashcard

Chi-Square Test of Independence

Reveal the definition

A chi-square test of independence checks whether two categorical variables are associated in a population.

Effortless Math. “Chi-Square Test of Independence.” Math Dictionary.