Chi-Square Tests of Independence and Homogeneity

Apply the chi-square statistic to two-way contingency tables: the test of independence (one sample, two categorical variables) and the test of homogeneity (several samples, one categorical variable). Both tests use the same expected counts, test statistic, and degrees of freedom; only the sampling design and hypotheses differ.

Step 1 of 157%

Tutorial

Testing Independence of Two Categorical Variables

The chi-square test of independence assesses whether two categorical variables measured on the same sample of nn subjects are statistically independent. The data are organized in an r×cr \times c contingency table of observed counts OijO_{ij}.

The hypotheses are

H0:the two variables are independent,H1:the two variables are not independent.\begin{aligned} H_0 &: \text{the two variables are independent}, \\ H_1 &: \text{the two variables are not independent}. \end{aligned}

Under H0H_0, the expected count in cell (i,j)(i,j) is

Eij=RiCjn,E_{ij} = \dfrac{R_i \cdot C_j}{n},

where RiR_i is the iith row total, CjC_j is the jjth column total, and nn is the grand total.

For example, consider the table

ABTotalR140R260Total3070100\begin{array}{c|cc|c} & A & B & \text{Total} \\ \hline R_1 & & & 40 \\ R_2 & & & 60 \\ \hline \text{Total} & 30 & 70 & 100 \end{array}

The expected count in cell (1,1)(1,1) is

E11=R1C1n=4030100=12.E_{11} = \dfrac{R_1 \cdot C_1}{n} = \dfrac{40 \cdot 30}{100} = 12.
navigate · Enter open · Esc close · ⌘K/Ctrl K toggle