Homogeneity and independence

Section of Exact tests for tables, part of Statistical inference

Homogeneity and independence

Type Section
Taught in Exact tests for tables
Part Statistical inference

Two experiments produce the same table and the same Pearson statistic, and they do not ask the same question.

A test of independence samples n individuals from one population and classifies each by two factors. The null hypothesis is p_{ij}=a_i b_j: the factors multiply. The row and column totals are both random.

A test of homogeneity draws a fixed sample from each of several populations, or assigns individuals to fixed groups, and classifies each by one response factor. The row totals are fixed by the design. The null hypothesis is that the response distribution is the same in every row: the conditional probabilities p_{j\mid i} do not depend on i.

The Pearson statistic, the likelihood-ratio statistic and Fisher’s exact test are calculated in the same way for both. The expected count under either null, once the margins are plugged in, is R_i C_j/n. The degrees of freedom are (r-1)(c-1) for both. Calling both “a test of association” describes the rejection: the factors are not associated. It hides the design. Independence is a statement about one joint distribution. Homogeneity is a statement about several conditional distributions being equal.

The practical difference shows up when the samples are planned. A study that recruits 40 science students and 40 arts students, then records computer preference, can estimate the preference distribution in each faculty. It cannot estimate the proportion of science students in the university, because that proportion was fixed by recruitment. The hypothesis it tests is homogeneity of preference across the two faculties. A study that stops 80 students in a corridor and records both faculty and computer tests independence in that stream of students, and both margins estimate population margins.

Small counts push either test toward the exact enumeration. The chi-squared approximation does not know which margin was fixed. The hypergeometric enumeration conditions on both, so it is valid for both designs.

# Same arithmetic either way: expected count is the product of margins over n.
# Homogeneity: row totals fixed. Independence: both margins random.
# The p-value from chisq.test is the shared large-sample summary.
chisq.test(matrix(c(8, 2, 3, 7), nrow = 2, byrow = TRUE), correct = FALSE)
Key idea

Condition on the margins. Under independence or homogeneity every table with those margins has a known probability, the hypergeometric probability, and the p-value is the chance of a table at least as rare as the one observed. The chi-squared test is the same arithmetic for a test of independence and a test of homogeneity. The hypothesis follows the design: one joint sample, or a separate sample from each group.

Used in

See also

Fisher’s exact test · Chi-squared test of independence

Glossary and index