Lably
Skip to content

Pearson's chi-squared test

Evaluates how likely it is that any difference between data sets arose by chance

  • 14 min read
  • 8 chapters

Related on Lably

Through Statistical hypothesis test, Chi-squared test and Statistics

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.

Sign in to keep reading

7 more chapters are free with a Lably account.

More in Statistics