Chi-Square Homogeneity

The chi-square test of homogeneity is a statistical procedure used to determine whether two or more populations share the same distribution of a categorical variable. Rather than asking 'are these variables related?' (as in a test of independence), homogeneity asks: 'do different groups look the same?' For example, do students in three different schools choose their favourite subject with the same proportions? The null hypothesis always states that the distributions are identical across all groups. The test works by comparing observed counts — the actual frequencies recorded in a two-way table — with expected counts, which are what we would predict if the distributions truly were the same in every group. The larger the discrepancy between observed and expected, the larger the test statistic, and the stronger the evidence against homogeneity. Because we are squaring differences, all deviations contribute positively to the statistic regardless of direction. Chi-square homogeneity is widely used in social science, medicine, marketing, and biology. A pharmaceutical company might test whether the proportion of patients experiencing side effects is the same across three dosage groups. A political pollster might ask whether voting preferences are distributed identically in urban, suburban, and rural areas. Mastering this test equips you with a powerful tool for drawing conclusions about real-world categorical data.

Key takeaways
  • State the hypotheses
  • Organise data into a two-way table
  • Calculate expected counts
  • Compute the chi-square test statistic
  • Find the p-value and draw a conclusion

State the hypotheses

H₀: The distribution of the categorical variable is the same (homogeneous) across all populations. Hₐ: At least one population has a different distribution. Always frame these in context — for example, 'The distribution of preferred news source is the same for teenagers and adults' versus 'The distributions differ for at least one group.'

Organise data into a two-way table

Rows represent the groups (populations) and columns represent the categories of the variable, or vice versa. Record the observed count Oᵢⱼ in each cell. Compute row totals, column totals, and the grand total n. The structure of the table determines degrees of freedom: df = (number of rows − 1)(number of columns − 1).

Calculate expected counts

For each cell (i, j), the expected count is Eᵢⱼ = (row i total × column j total) / grand total n. This formula distributes the column totals proportionally across each row, as if every group had the same distribution. Before proceeding, verify the conditions: (1) data come from independent random samples or a randomised experiment; (2) all expected counts are at least 5.

Compute the chi-square test statistic

Sum the quantity (O − E)²/E over every cell in the table. A large value means observed counts deviate greatly from what homogeneity predicts. The statistic follows an approximate chi-square distribution with df = (r − 1)(c − 1), where r is the number of rows and c is the number of columns.

Find the p-value and draw a conclusion

Using a chi-square table or technology, find the area to the right of χ² under the chi-square distribution with the correct degrees of freedom. If p-value ≤ α (commonly 0.05), reject H₀ and conclude that at least one group has a different distribution. If p-value > α, fail to reject H₀ — the data are consistent with homogeneous distributions. Always state your conclusion in the context of the original problem.

The Key Equation

χ2=∑all cells(Oij−Eij)2Eij,Eij=(Rowi total)(Colj total)n\chi^2 = \sum_{\text{all cells}} \frac{(O_{ij} - E_{ij})^2}{E_{ij}}, \quad E_{ij} = \frac{(\text{Row}_i \text{ total})(\text{Col}_j \text{ total})}{n}
  • O_{ij} — Observed count (frequency (count)): The actual number of observations recorded in row i, column j of the data table.
  • E_{ij} — Expected count (frequency (count)): The count we would predict in cell (i,j) if the null hypothesis of homogeneous distributions were true.
  • \chi^2 — Chi-square test statistic (dimensionless): A non-negative value measuring the total discrepancy between observed and expected counts; larger values give more evidence against H₀.
  • n — Grand total (count): The total number of observations across all groups and all categories.
  • df — Degrees of freedom (dimensionless): Equals (r − 1)(c − 1), where r is the number of rows (groups) and c is the number of columns (categories). Determines which chi-square distribution to use.

Worked Example

Problem. A school counsellor surveys students in three year groups (Year 10, Year 11, Year 12) about their preferred revision method: Flashcards, Practice Problems, or Re-reading. The observed counts are: Year 10 — 30, 50, 20 (total 100); Year 11 — 40, 40, 20 (total 100); Year 12 — 20, 60, 20 (total 100). Grand total = 300. Test at α = 0.05 whether the distribution of preferred revision method is the same across the three year groups.

χ2=10.67,  df=4,  p<0.05⇒Reject H0\chi^2 = 10.67,\; df = 4,\; p < 0.05 \Rightarrow \text{Reject } H_0

Answer. χ² = 10.67, df = 4, p-value < 0.05. Reject H₀. The distribution of revision method preference is not homogeneous across year groups.

Figure
Diagram
Chi-Square Distribution: Critical Region (df = 4)χ²* = 9.488α = 0.05Reject H₀χ² valueDensity024689.49Our χ²=10.6710.67── chi-square curve (df=4)rejection region- - test statistic
Origins · 1 minKarl Pearson and how this was discovered
KP
Karl Pearson
1857–1936 · British

Karl Pearson introduced the chi-square test in 1900 in a landmark paper titled 'On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling.' He derived the chi-square goodness-of-fit test and laid the foundations for all chi-square procedures used today, including tests of independence and homogeneity. He also founded the journal Biometrika and coined the term 'standard deviation.' Pearson was famously embroiled in a bitter intellectual feud with Ronald Fisher — another giant of statistics — that lasted decades and divided the statistical community into rival camps.

  • Chi-Square Test of Independence — Both tests use the same χ² statistic and expected-count formula; the key difference is that independence tests a single sample for association between two variables, while homogeneity tests multiple independent samples.
  • Chi-Square Goodness of Fit — Goodness-of-fit tests compare an observed distribution to a specified theoretical distribution using the same (O−E)²/E formula, forming the conceptual building block for homogeneity tests.
  • Conditions for Statistical Inference — All chi-square tests require random sampling, independence of observations, and minimum expected cell counts of 5 — conditions that must be verified before any conclusion is valid.
  • P-Values and Statistical Significance — Interpreting chi-square results depends entirely on understanding p-values: the probability of obtaining a test statistic at least as extreme as observed, assuming H₀ is true.