- Used for counts in categories (absolute numbers, not a proportion alone): is there a relation between two categorical variables, or do proportions differ? H0: P1 = P2.
- Data go in a contingency (cross-tabulation) table, exposure as rows and outcome as columns.
- Expected count per cell = row total x column total / grand total.
- chi-square = sum of (O - E) squared / E; large gaps between O and E reject H0. It is always an upper one-sided test.
- df = (rows - 1) x (columns - 1); the critical value depends on alpha and df (3.84 at df 1, alpha 0.05).
- Validity: no expected count below 1, and fewer than 20% below 5; for a small 2 x 2 table use Fisher's exact test, and Yates' correction can be applied to 2 x 2.
Influenza: vaccine 20 of 240 infected, placebo 80 of 220. Expected for the vaccine cell = 240 x 100 / 460 = 52.2. chi-square = about 53.0, far above 10.83 (df 1, alpha 0.001), so p < 0.001 and the vaccine effect is real.
- Chi-square test: A test that compares observed and expected category counts to assess an association or a difference in proportions. (lecture slide 7)
- Expected count: The number predicted for a table cell under the null hypothesis, calculated by multiplying its row and column totals and dividing by the grand total. (lecture slide 5)