Português

Chi-square test of homogeneity

Proportions (counts) · Three or more independent groups · reference distribution: χ²((r−1)(c−1))

When to use it

Compare the distribution of a categorical variable across three or more independent groups.

Null hypothesis

The proportion of each category is the same in every group.

Assumptions

Test statistic

\chi^2 = \sum \dfrac{(O - E)^2}{E}

Effect size

Cramér’s V, from 0 to 1.

V = \sqrt{\dfrac{\chi^2}{N\,(\min(r, c) - 1)}}

How to report it

χ²(4, N = 300) = 11.2, p = .024, V = .14

In R and Python

R
chisq.test(table)
Python
stats.chi2_contingency(table)

In Python, stats is scipy.stats and np is numpy.

Variants and alternatives

Where it sits in the catalog

Proportions (counts). For categorical answers, such as yes or no, hit or miss: the data are how often each category appears, and the test compares proportions.

Three or more independent groups. Several groups of different individuals, tested at once: one test per pair would inflate the type I error.

In the decision tree

  1. What do you want to do? Compare groups, or one group with a reference value
  2. What kind of response did you measure? Categorical: yes or no, or categories
  3. How many groups or measurements? Three or more independent groups

Open the decision tree