ArticleslgStudy

mathematics

Pearson's chi-squared test

Pearson's chi-squared test is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Pearson's chi-squared test rather than just read about it. In short: Pearson's chi-squared test or Pearson's χ2 test is a statistical test applied to sets of categorical data to evaluate how likely it is that any observed difference between the sets arose by chance. It is the most widely used of many chi-squared tests (e.g., Yates, likelihood ratio, portmanteau test in time series, etc.) – statistical procedures whose results are evaluated by reference to the chi-squared distribution.

Pearson's chi-squared test — main illustration
Pearson's chi-squared test — illustration

Key takeaways

  • Pearson's chi-squared test belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Pearson's chi-squared test to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Pearson's chi-squared test from memory before moving on to harder problems.

Reference excerpt

Pearson's chi-squared test or Pearson's χ2 test is a statistical test applied to sets of categorical data to evaluate how likely it is that any observed difference between the sets arose by chance. It is the most widely used of many chi-squared tests (e.g., Yates, likelihood ratio, portmanteau test in time series, etc.) – statistical procedures whose results are evaluated by reference to the chi-squared distribution. Its properties were first investigated by Karl Pearson in 1900. In contexts where it is important to improve a distinction between the test statistic and its distribution, names similar to Pearson χ-squared test or statistic are used. It is a p-value test. A simple example is testing the hypothesis that an ordinary six-sided die is "fair" (i. e., all six outcomes are equally likely to occur). In this case, the observed data is (O1,O2,...,O6), the number of times that the die has fallen on each number. The null hypothesis is Multinomial(N;1/6,...,1/6), and χ2:=∑i=16(Oi−N/6)2N/6. As detailed below, if χ2>11.07, then the fairness of the die can be rejected at the level of p<0.05.

Procedure The setup is as follows:

Before the experiment, the experimenter fixes a certain number N of samples to take. The observed data is (O1,O2,...,On), the count number of samples from a finite set of given categories. They satisfy ∑iOi=N. The null hypothesis is that the count numbers are sampled from a multinomial distribution Multinomial(N;p1,...,pn). That is, the underlying data is sampled IID from a categorical distribution Categorical(p1,...,pn) over the given categories. The Pearson's chi-squared test statistic is defined as χ2:=∑i(Oi−Npi)2Npi. The p-value of the test statistic is computed either numerically or by looking it up in a table. If the p-value is small enough (usually p < 0.05 by convention), then the null hypothesis is rejected, and we conclude that the observed data does not follow the multinomial distribution.

Usage Pearson's chi-squared test is used to assess three types of comparison: goodness of fit, homogeneity, and independence.

A test of goodness of fit establishes whether an observed frequency distribution differs from a theoretical distribution. A test of homogeneity compares the distribution of counts for two or more groups using the same categorical variable (e.g. choice of activity—college, military, employment, travel—of graduates of a high school reported a year after graduation, sorted by graduation year, to see if number of graduates choosing a given activity has changed from class to class, or from decade to decade). A test of independence assesses whether observations consisting of measures on two variables, expressed in a contingency table, are independent of each other (e.g. polling responses from people of different nationalities to see if one's nationality is related to the response). For all three tests, the computational procedure includes the following steps:

Calculate the chi-squared test statistic, χ2, which resembles a normalized sum of squared deviations between observed and theoretical frequencies (see below). Determine the degrees of freedom, df, of that statistic. For a test of goodness-of-fit, df = Cats − Params, where Cats is the number of observation categories recognized by the model, and Params is the number of parameters in the model adjusted to make the model best fit the observations: The number of categories reduced by the number of fitted parameters in the distribution. For a test of homogeneity, df = (Rows − 1)×(Cols − 1), where Rows corresponds to the number of categories (i.e. rows in the associated contingency table), and Cols corresponds to the number of independent groups (i.e. columns in the associated contingency table). For a test of independence, df = (Rows − 1)×(Cols − 1), where in this case, Rows corresponds to the number of categories in one variable, and Cols corresponds to the number of categories in the second variable. Select a desired level of confidence (significance level, p-value, or the corresponding alpha level) for the result of the test. Compare χ2 to the critical value from the chi-squared distribution with df degrees of freedom and the selected confidence level (one-sided, since the test is only in one direction, i.e. is the test value greater than the critical value?), which in many cases gives a good approximation of the distribution of χ2. Sustain or reject the null hypothesis that the observed frequency distribution is the same as the theoretical distribution based on whether the test statistic exceeds the critical value of χ2. If the test statistic exceeds the critical value of χ2, the null hypothesis (H0 = there is no difference between the distributions) can be rejected, and the alternative hypothesis (H1 = there is a difference between the distributions) can be accepted, both with the selected level of confidence. If the test statistic falls below the threshold χ2 value, then no clear conclusion can be reached, and the null hypothesis is sustained (we fail to reject the null hypothesis), though not necessarily accepted.

Test for fit of a distribution

Discrete uniform distribution In this case N observations are divided among n cells. A simple application is to test the hypothesis that, in the general population, values would occur in each cell with equal frequency. The "theoretical frequency" for any cell (under the null hypothesis of a discrete uniform distribution) is thus calculated as Ei=Nn, and the reduction in the degrees of freedom is p=1, notionally because the observed frequencies Oi are constrained to sum to N. One specific example of its application would be its application for log-rank test.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Pearson's chi-squared test

Start with the simplest possible case. Write down what Pearson's chi-squared test claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Pearson's chi-squared test before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Pearson's chi-squared test ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Pearson's chi-squared test

In research
Pearson's chi-squared test appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Pearson's chi-squared test in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Pearson's chi-squared test is common in secondary-school and first-year university syllabi. It links to neighbouring topics Normality tests, Statistical approximations, Statistical tests for contingency tables, so understanding it makes those chapters shorter.
In everyday life
Look for Pearson's chi-squared test outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Pearson's chi-squared test” →

How to study Pearson's chi-squared test in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Pearson's chi-squared test means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Pearson's chi-squared test out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Pearson's chi-squared test in simple terms?

Pearson's chi-squared test or Pearson's χ2 test is a statistical test applied to sets of categorical data to evaluate how likely it is that any observed difference between the sets arose by chance. It is the most widely used of many chi-squared tests (e.g., Yates, likelihood ratio, portmanteau test…

Why does Pearson's chi-squared test matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Pearson's chi-squared test?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Pearson's chi-squared test.

Tags

  • Normality tests
  • Statistical approximations
  • Statistical tests for contingency tables

Keep exploring