Chi-Square Test of Independence

Test whether two categorical variables are related, from a two-way table (χ²-Test).

Inputs

One row per line; separate the columns with spaces or tabs. Copying a block of cells from Excel works.

Significance level α

Results update as you type.

Results

Reject H₀: χ² = 10.7458, p-value = 0.0046

The p-value (0.0046) is less than or equal to α = 0.05, so the data give enough evidence to conclude that the two variables are related.

Chi-square distribution with 2 degrees of freedom curve. The shaded p-value region is the area to the right of χ² = 10.75, with area 0.0046. Dashed line marks the critical value 5.991.02.557.51012.5χ² = 10.75critical 5.991

Results

χ² test statistic10.7458
df = (rows − 1)(columns − 1)2
p-value0.0046
Critical value5.991
Decision at α = 0.05Reject H₀
Observed counts (expected counts in parentheses)
Column 1Column 2Column 3Total
Row 120 (24)15 (19.2)25 (16.8)60
Row 230 (26)25 (20.8)10 (18.2)65
Total504035125

On the TI-84

2nd x−1 (MATRIX) → EDIT → [A], set it to 2 × 3 and type the counts. Then STAT → TESTS → C:χ²-Test, Observed [A], Expected [B]. The expected counts are stored in [B].

χ²-Test [A], [B]

Show steps
  1. Hypotheses. H₀: the two variables are independent   Ha: they are related (not independent)
  2. Expected counts. E = (row total × column total) ÷ grand total. For example, the top-left cell: 60 × 50 ÷ 125 = 24.
  3. Test statistic. χ² = Σ (O − E)² ÷ E over all 6 cells = 10.7458, df = (2 − 1)(3 − 1) = 2.
  4. p-value. Right-tailed test: area to the right of the test statistic: p-value = 0.0046. Since 0.0046 ≤ 0.05, reject H₀.
  5. Critical-value method. At α = 0.05, the rejection region is χ² ≥ 5.991. The test statistic χ² = 10.7458 is in the rejection region, so we reject H₀. (Same decision as the p-value method.)
  6. Conclusion. The p-value (0.0046) is less than or equal to α = 0.05, so the data give enough evidence to conclude that the two variables are related.

About this calculator

When to use this

Use a test of independence when each person (or item) is classified by two categorical variables, such as course format and pass/fail, and the counts are arranged in a two-way table. The question is whether the variables are related.

Expected counts

If the variables were independent, each cell's expected count would be (row total × column total) ÷ grand total. The farther the observed counts are from those, the larger χ² gets. The test is right-tailed with df = (rows − 1)(columns − 1).