Inference for Categorical Data: Chi-Square

AP Statistics · Advanced Placement

Inference for Categorical Data: Chi-Square: the big picture

Chi-square procedures analyse counts in categories. A goodness-of-fit test compares observed counts with those expected under a claimed distribution, a test of homogeneity compares distributions across several populations, and a test of independence asks whether two categorical variables in one population are associated.

Goodness of fit

To test whether a categorical variable follows a specified distribution, expected counts are n times each hypothesised proportion, and the statistic χ² = Σ (O − E)²/E measures the total discrepancy. The degrees of freedom are the number of categories minus one, and a large χ² gives a small P-value. Conditions are a random sample, independence and all expected counts at least 5.

{{illustration:mh-math-apstats-u8-f1}}

Key relations

- Chi-square statistic. the sum over categories of observed minus expected, squared, divided by expected

Homogeneity and independence

In a two-way table of counts, the expected count for a cell is (row total × column total)/grand total under the null hypothesis of no difference or no association, and χ² is computed as before with degrees of freedom (rows − 1)(columns − 1). A test of homogeneity compares the distribution of a variable across several populations or treatments, while a test of independence studies two variables measured in one sample. A significant result indicates association but not its nature, so conditional distributions are examined.

Key relations

- Expected count in a two-way table. the row total times the column total divided by the grand total