MegaMaester

Statistics for Everyday Life · Lesson 2

Categorical Data: The Chi-Square Test

beginner16 min · 13 cards
Start here

Categorical Data: The Chi-Square Test

The chi-square test checks whether two categories are related more than chance would predict — a plain-language guide to analysing categorical data.

Concept 1 of 10

Why this matters

Not all data are numbers you average. Much of the world comes in categories: yes/no, passed/failed, which product someone chose, whether a treatment group recovered. When you want to know whether two such categories are related, the t-test won't do — you need a different tool. The most common is the chi-square test.

Concept 2 of 10

Core concepts

Categorical questions

Categorical data sort things into groups rather than measuring an amount. A typical question: is there a relationship between two categories — say, between taking a medication (yes/no) and recovering (yes/no)? You arrange the counts in a table (a contingency table) and ask whether the pattern is more lopsided than chance would produce.

Observed versus expected

The chi-square test compares the counts you actually observed with the counts you'd expect if the two categories were completely unrelated (independent). If observed and expected are close, there's little evidence of a relationship; if they diverge a lot, that suggests an association.

Independence and association

The test essentially asks whether the two variables are independent (unrelated) or associated (the value of one tells you something about the other). As always, an association is not proof of causation — the chi-square test finds patterns, not causes.

Concept 3 of 10

Worked example

A shop wants to know whether customers who saw a display (yes/no) were more likely to buy a product (yes/no). It tabulates the four counts. If buyers are spread across 'saw display' and 'didn't' roughly as expected under no relationship, chi-square finds little; if buyers cluster strongly among those who saw the display, beyond what chance would give, the test flags an association worth investigating.

Concept 4 of 10

Counterexample

Chi-square answers 'is there an association?' — not 'how strong?' or 'why?'. A significant chi-square in a huge dataset may reflect a tiny, unimportant association; and a found association could be driven by a lurking third factor (perhaps people who seek out the display were already keen to buy). The test detects a pattern; interpreting it still needs judgment.

Concept 5 of 10

Case study: a foundational tool from 1900

The chi-square test was introduced by the statistician Karl Pearson around 1900, and it became one of the foundational tools of modern statistics. Its power was to give researchers a rigorous way to ask whether observed frequencies — in biology, medicine, social science, and beyond — differed from what chance alone would produce. Before such tests, judging whether a pattern in categorical counts was 'real' relied on intuition; Pearson's method made it systematic. More than a century later, chi-square remains one of the most widely used tests precisely because so many real questions are categorical: did more people in one group respond, choose, survive, or fail than you'd expect if the groups were the same? It endures because that question is everywhere.

Concept 6 of 10

Common misconceptions

  • "You can average categorical data." Categories are counted and compared, not averaged.
  • "A significant chi-square proves causation." It shows association; causes require more.
  • "Chi-square measures how strong the relationship is." It flags whether a relationship exists, not its strength.
  • "Any table can be tested reliably." Very small expected counts can make the standard test unreliable.
Concept 7 of 10

Interactive challenge — Build the table

Think of two yes/no categories you're curious about (e.g., 'exercised today' and 'slept well'). Sketch the four-cell table. What pattern of counts would suggest an association versus none?

Think Like a Maester: For questions about categories, compare what you observed with what pure chance would expect — the gap is where the story lives.

Concept 8 of 10

Knowledge check

  1. What kind of data is the chi-square test for?
  2. What does the test compare?
  3. What is the difference between independence and association?
  4. Why does a significant chi-square not prove causation?
  5. Who introduced the chi-square test, and why was it foundational?
Concept 9 of 10

Lesson summary

The chi-square test analyses categorical data, comparing the counts you observed with those expected if two categories were unrelated; a large gap suggests an association. Introduced by Karl Pearson around 1900, it made judging categorical patterns systematic and remains among the most-used tests because so many real questions are categorical. Like all such tools, it detects association, not causation or strength, so its results still require careful interpretation.

Quick check

A t-test primarily answers the question: