Chi-Squared Test

The Chi-Squared Test (χ²)

The chi-squared test (χ²) is a non-parametric test used when the research question concerns the relationship between two nominal (categorical) variables, or whether observed frequencies differ significantly from expected frequencies. It works with counts (frequencies) of how many observations fall in each category combination, not with continuous measurements.

When to Use Chi-Squared

Chi-squared is appropriate when:

  • Data are at nominal level — observations are classified into categories
  • The research question concerns association (are two categorical variables related?) or difference in frequencies (do observed frequencies differ from expected?)
  • The design is unrelated — each participant contributes to one, and only one, cell of the contingency table
  • Expected frequencies in each cell are at least 5 — small expected frequencies make the chi-squared approximation unreliable

The Contingency Table

Chi-squared operates on a contingency table — a grid showing the observed frequency of each combination of categories. For example, testing whether diagnosis (depression/anxiety) is associated with treatment choice (CBT/medication) would produce a 2×2 contingency table:

CBTMedicationRow Total
DepressionO = 30O = 2050
AnxietyO = 15O = 3550
Column Total4555N = 100

Procedure

  1. Calculate the expected frequency (E) for each cell: E = (Row Total × Column Total) / N. This is the frequency expected if the two variables were completely independent.
  2. For each cell, compute: (O − E)² / E, where O = observed frequency.
  3. Sum all (O − E)² / E values: χ² = Σ [(O − E)² / E]
  4. Calculate degrees of freedom: df = (rows − 1) × (columns − 1). For a 2×2 table: df = 1.
  5. Compare the calculated χ² to the critical value from the chi-squared table for the relevant df and α.

Significance rule: significant if calculated χ² ≥ critical value.

Yates' Correction

For 2×2 tables only, Yates' correction for continuity is sometimes applied: instead of (O−E)², use (|O−E| − 0.5)². This makes the test more conservative (harder to reach significance) and is recommended by some statisticians when expected frequencies are between 5 and 10, though it is not universally applied.

Limitation: Cannot Establish Cause and Effect

Chi-squared, like all non-experimental tests, can only demonstrate association between two categorical variables — it cannot establish which variable causes which, or rule out third variables. A significant χ² means the observed distribution of frequencies is unlikely under the assumption of independence, not that one variable causes the other.

 Key Takeaways

  • Chi-squared (χ²): non-parametric test for nominal data — tests association between two categorical variables or whether observed frequencies differ from expected.
  • Requires: nominal data; unrelated design (each participant in one cell only); expected frequency ≥ 5 in each cell.
  • Expected frequency E = (Row Total × Column Total) / N — what frequencies would be expected if the variables were independent.
  • χ² = Σ[(O−E)²/E]. df = (rows−1)(columns−1). Significant if χ² ≥ critical value.
  • Yates' correction: (|O−E|−0.5)² instead of (O−E)² for 2×2 tables — makes the test more conservative; used when expected frequencies are small.
  • Chi-squared can only establish association — not causation. Third variable and directionality problems apply.