StudyVisuallyStart studying
Part 07 · Comparing categories and many groups · Card 3 of 8

Chi-square test of independence

This test checks whether two categorical variables are related. The null says they are independent. Compute the sum of (O - E) squared / E over all cells, with (rows - 1) x (columns - 1) degrees of freedom.

Last updated

Analogy

Do people in group A answer yes more often than people in group B?

Example

A 2 by 2 table

Observed 30, 20, 20, 30; expected 25 eachEach cell: 25 / 25 = 1Chi-square = 4 x 1 = 4.0df = 1, critical = 3.841p = 0.046: reject independence

In practice

Used for survey results, such as whether preference depends on age group.

Practice

Flashcards

  • Degrees of freedom for an r by c table?(r - 1) x (c - 1).

Interview questions

  • In a 2 by 2 table the observed counts are 30, 20, 20 and 30. Test whether the two variables are independent at the 5% level.
    • Expected count 25 in every cell
    • Chi-square = 4.0
    • df = 1, critical 3.841
    • Reject independence

Questions people ask

How do I find the degrees of freedom for a table?

Multiply the number of rows minus 1 by the number of columns minus 1. A 3 by 4 table has 2 x 3 = 6 degrees of freedom. A 2 by 2 table has 1. This counts how many cells can vary once the totals are fixed.

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

No. It only shows the variables are associated. Other factors may explain the link, and the direction of any cause is unknown. Only a well-designed experiment with random assignment can support a causal claim. A survey can show that two things travel together, but not why they do.