Advertisement

Test whether observed frequencies match expected frequencies.

Test whether two categorical variables are independent. Enter the contingency table — one row per line, values separated by commas.

Advertisement

Guide: Chi-Square Test

The chi-square (χ²) test is a statistical test for categorical data. It compares observed counts to expected counts to determine whether a significant difference exists.

There are two main variants: the goodness-of-fit test (one variable, comparing to a theoretical distribution) and the test of independence (two variables, testing if they are associated).

Goodness of fit: You have one categorical variable and want to test whether the observed frequencies match an expected distribution. Example: "Are the outcomes of a die roll uniformly distributed?"

Test of independence: You have a contingency table with two categorical variables and want to know if they are associated. Example: "Is gender associated with product preference?" Enter the raw cell counts as a matrix.

Cramér's V is an effect size measure for chi-square tests, ranging from 0 (no association) to 1 (perfect association). It corrects for the fact that chi-square grows with sample size, making it a pure measure of effect regardless of n.

Interpretation: small (~0.1), medium (~0.3), large (~0.5). Use Cramér's V alongside the p-value to distinguish statistical significance from practical importance.

  • Categorical data: Variables must be counts/frequencies, not means
  • Independence: Each observation must belong to only one cell
  • Expected frequencies: The rule of thumb is that at least 80% of cells should have an expected count ≥ 5. If this is violated, consider Fisher's Exact Test or combining categories
  • Random sample: Data should come from a random sample